// carqueue.h: the CarQueue class, representing the lineup of cars at the // gas station. class CarQueue { private: // QueueItem: the type for objects stored in the car queue. struct QueueItem { // The car queue is a linked list, so each item contains a data field // and a "next item" field. Car *data; QueueItem *next; }; QueueItem *firstWaitingCar; QueueItem *lastWaitingCar; int queueSize; double totalEmptyQueueTime; public: // Constructor. // The list of "name (value)" pairs after the colon and before the // constructor body provides initial values for those data members. CarQueue () : firstWaitingCar (0), lastWaitingCar (0), queueSize (0), totalEmptyQueueTime (0.0) { } // getEmptyTime: return the total time the car queue has been empty. double getEmptyTime (); // getQueueSize: return the number of cars in the car queue. int getQueueSize () { return queueSize; } // insert: put a newly-arrived car into the car queue. void insert (Car *newestCar); // takeFirstCar: remove first car from car queue and return it. Car *takeFirstCar (); };