Rules

A university 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 wasnt 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 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.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.