To gain practice with this stuff we are going to take a look at
a parking lot simulation. The program will have a parkinglot that has some
capacity for how many cars can be parked there. This parkinglot has a Valet
that parks and retrieves all the cars. The program should do the following:
Present the user with a list (park car, get car, quit). If park car is selected then prompt the user for the name of the driver. A person object should be created that holds the name of the person and randomly picks an integer value that will represent the license plate for the car the person owns. A car object should be created with that license plate. The car should then be parked in the lot. If the lot is full then a message should be displayed saying no more room in the lot.
If the user picks get car then a random person should be selected from those that have driven into the parkinglot and that person's car should be found and removed from the parkinglot. If there are no cars in the lot then a message should be displayed saying there are no cars in the lot.
if the user picks quit then the program should terminate. To help you in this project the following classes have been created for you.
methods
public Person(String name) //randomly assigns a value for the license
public String getName()
public int askAboutCar() //returns the license number
methods
public int getLicense()
data members
ParkingLot lot
MessageBox mesg
InputBox in
ListBox menu
methods
private void parkCar()
private void getCar()
public void startWork()
public static void main(String args[])
Here are the links to the files that you will need to download:
Car.java
CarCollection.class
ParkingLot.class
Person.java
Valet.java
Valet2.java