|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectParkingLot
This class models a parking lot. The ParkingLot maintains a list of Cars in the lot, and lets the Cars come and go. It has an infinite number of parking spots, but it's a little inconvenient to use because the most recent Car to arrive is the only one that can leave. After it is gone, then the Car that arrived before it can leave, and so on. Thus, the first Car to arrive cannot leave until all other Cars have left.
Constructor Summary | |
ParkingLot()
A new ParkingLot object does not have any cars on it, initialize appropriately. |
Method Summary | |
int |
getCarCount()
Return the number of Cars presently in the ParkingLot. |
void |
parkCar(ArrayList cars)
Park several Cars in the lot (ie, add them to the end of the list of cars currently in the lot). |
void |
parkCar(Car car)
Park one Car in the lot (ie, add it to the end of the list of cars currently in the lot). |
Car |
unparkCar()
Take the last car that was parked out of the lot. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ParkingLot()
Method Detail |
public void parkCar(Car car)
car
- the Car to parkpublic void parkCar(ArrayList cars)
cars
- a List of Cars to parkpublic Car unparkCar()
public int getCarCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |