Overview
For this assignment, we will practice using stacks and queues. In this exercise, you will create two stacks and a queue to keep track of cars using a parking lot. We will use the nature of the stacks and queues to solve the problem.
Specifications
Rules
FIU has opened a new valet parking lot next to the PC building that requires a special decal to park. As the developer, you can select the special decal and the program should ask the user what decal they have for the car. If the user does not have the correct parking decal to park in the lot, the driver should be told nicely that they do not have the correct permit to park in this lot. For the purposes of this program, we will assume that the user always tells the truth about the decal they have for their car.
The parking lot is a “last-in, first-out” stack. When parking a new car, the program must first check to see if the car has the correct decal. If it does have the correct permit, the car may be added to the lot as long as there is enough room. To park a car, the car’s license tag is added to the parking lot stack. The parking lot can hold 20 cars at a time. If the parking lot is full, a waiting car can be added to a waiting queue. When a car leaves the lot, the next car in the queue will be able to park in the parking lot before allowing a new car to be entered. When a car owner retrieves a vehicle that wasn’t the last one in, the cars blocking it must temporarily move to the street so that the requested vehicle can leave.
Write a program that models this behavior, using one stack representing the the parking lot and one stack representing the street. A queue will be used to store the cars waiting for a place to park of the lot is full.
Use integers as license plate numbers. Positive numbers add a car, negative numbers remove a car, zero stops the simulation. For example, if I am attempting to park my car I would enter my license plate as 0569. When I’m ready to retrieve my call, I would enter -0569. The positive number tells the program that I wish to park my car, prompting the program to ask me my decal type. The program should tell me if I have the correct decal and if there is room to park my car. If the stack representing the parking lot is full, my car should be added to the waiting queue.
If I remove my car by entering -0569, the next car in the queue should be parked before a new car can be entered unless the queue is empty. The status of the parking lot and the waiting queue after each operation is complete. The status includes the cars that are parked in the lot as well as the cars that are currently waiting in the queue to park.
Expected Output:
The expected output should contain the list of cars currently parked in the parking lot and the list of cars currently waiting to park after each car is entered. The program should also tell the user if they have a correct decal. If they do, the program should tell the driver if their car will be parked in the lot or if it must wait in the waiting queue for a space to become available. If they do not, the program should politely tell the user that they do not have the correct deal to part in this lot.
Java Requirements
The program must
- Utilize a stack representing the parking lot.
- Utilize a stack representing the street.
- Utilize a queue to store the cars waiting to park.
- Check the parking decal type and politely tell the driver if they do not have the correct decal.
- Limit the number of cars parking in the lot to a maximum of 20.
- Output that includes the cars parked in the lot and any cars waiting in the queue to park after each operation.
- Have an easy to understand user interface that allows the user to park a car or retrieve a parked car.
Once you have it working as expected upload the .java file to this assignment drop box. You must also submit a Word doc or text file containing the Java code. Assignments not containing both the Java code and the text or Word file will be assigned a 0 for a grade.
Rubric
Project 7 Rubric
| Criteria | Ratings | Pts | |||
|---|---|---|---|---|---|
|
This criterion is linked to a Learning OutcomeUtilize a stack representing the parking lot |
|
10 pts |
|||
|
This criterion is linked to a Learning OutcomeUtilize a stack representing the street |
|
10 pts |
|||
|
This criterion is linked to a Learning OutcomeUtilize a queue to store the cars waiting to park |
|
10 pts |
|||
|
This criterion is linked to a Learning OutcomeCheck the parking decal type and politely tell the driver if they do not have the correct decal |
|
10 pts |
|||
|
This criterion is linked to a Learning OutcomeLimit the number of cars parking in the lot to a maximum of 20 |
|
10 pts |
|||
|
This criterion is linked to a Learning OutcomeOutput includes the cars parked in the lot and any cars waiting in the queue to park after each operation |
|
10 pts |
|||
|
This criterion is linked to a Learning OutcomeHave an easy to understand user interface that allows the user to park a car or retrieve a parked car |
|
10 pts |
|||
|
This criterion is linked to a Learning OutcomeCode compiles and runs without errors |
|
5 pts |
|||
|
This criterion is linked to a Learning OutcomeCode is properly commented |
|
10 pts |
|||
|
This criterion is linked to a Learning OutcomeProgram is properly designed and uses whitespace effectively |
|
15 pts |
|||
|
Total Points: 100 |
|||||


0 comments