cs 302 section 5 Lab

The goal of this lab is

Problem description


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.

You will need to implement at least the following classes:

Person class

data members
String name
int license

methods
public Person(String name) //randomly assigns a value for the license
public String getName()
public int askAboutCar() //returns the license number
 
 

Car class

data members
int license

methods
public int getLicense()
 

Valet class

this class is the main class for the project.  it will be the class that creates copies of the other classes when needed.  We will handle this class a bit different then you have done previously.  Think of this class like an instantiable class.  What data members and methods are needed to have a Valet (acting like described above in the problem description).  We will about why we do this today in lab and give a better explanation of what each method should do.

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