There are two parking garages each have a maxqueue of 5. There is also a street that cars could wait until a spot opens up. When a spot opens up in one of the garages the first car in the street queue must be moved into that open spot. Also when the car exits the garage it must state which garage it came out of and the fee (if first spot in garage $10 second $20 and anything else $25). When I run the program it reads the fee if its in the first spot.
Here is my code:
#include <iostream>
#include <fstream>
using namespace std;
cout << "Enter an 'a' if your car is arriving or enter a 'd' if your car is departing. Enter q to quit: " << endl;
cin >> choice;
cout << "Enter license plate number: " << endl;
cin >> car;
while ((choice != 'q') || (choice != 'Q'))
{
if ((choice == 'a') || (choice == 'A'))
enter(car, choice);
else if ((choice == 'd') || (choice == 'D'))
depart(car, choice);
if (!(knock.full_queue()))
{
knock.insert_queue(car);
cout << "Car " << car << " has been parked in the Knockemdead Parking Garage. " << endl;
}
else if (!(bash.full_queue()))
{
bash.insert_queue(car);
cout << "Knockemdead is full! Car " << car << " has been parked in the Bashemup parking garage. " << endl;
}
else if (!(street.full_queue()))
{
street.insert_queue(car);
cout << "Both lots are full! Car " << car << " has been parked in the street until a spot opens up. " << endl;
}
else
{
cout << "All lots are full! Go to Boston! " << endl;
}
cout << "Enter an 'a' OR 'A' if your car is arriving or enter a 'd' OR 'D' if your car is departing. Enter q to quit: " << endl;
cin >> choice;
cout << "Enter license plate number: " << endl;
cin >> car;
while ((choice != 'q') || (choice != 'Q'))
{
if ((choice == 'a') || (choice == 'A'))
enter(car, choice);
else if ((choice == 'd') || (choice == 'D'))
depart(car, choice);