//----------------------------------------------------------------------
//  parksim.cpp
//  This program simulates a parking lot.  Actions are specified by
//  user commands from standard input.
//----------------------------------------------------------------------
#include "pkglot.h"     // For PkgLotType class
#include <iostream.h>
#include <ctype.h>      // For toupper()

void ReadCommand( char& );
void ReadTicket( int& );

int main()
{
    PkgLotType pkgLot;
    char       command;
    int        ticketStub;

    do {
        ReadCommand(command);
        switch (command) {
            case 'P':
                pkgLot.Park();
                break;
            case 'R':
                ReadTicket(ticketStub);
                pkgLot.Retrieve(ticketStub);
                break;
            case 'D':
                pkgLot.Display();
                break;
            default:
                ;
        }
    } while (command != 'Q');

    return 0;
}

void ReadCommand( /* out */ char& command )
    //..................................................................
    // POST: User has been prompted for a single char
    //    && command == uppercase equivalent of that char
    //..................................................................
{
    cout << "\nD)isplay  P)ark  R)etrieve  Q)uit: ";
    cin >> command;
    command = toupper(command);
}

void ReadTicket( /* out */ int& ticketStub)
    //..................................................................
    // POST: ticketStub == integer prompted for and input from user
    //..................................................................
{
    cout << "Ticket no.: ";
    cin >> ticketStub;
}


