# Thread: Car wash simulation with queues

1. ## Car wash simulation with queues

Having difficulty with understanding how to code the rest of this program. Simulation Problem:

You own a car wash business and want to analyze customer service information. The car wash opens at 8:00am. Customers drive up to a ticket dispenser where they choose option 1 for a wash only or option 2 for a wash and wax. The customer receives a car wash ticket which has the time in hours and minutes and the option number (1 or 2). The customer drives through the car wash once it is open and not busy. The time for option 1 is 10 minutes; the time for option 2 is 14 minutes.

suggested pseudocode:

Build the customer queue

While (customer queue is not empty)

Get a customer item from the queue

Determine the wash time

Determine the start time for this customer car

Determine the finish time for this customer car

Determine the wait time for this customer car

Print the information for this customer

Calculate and print the average wait time

Here's what i have so far

Code:
```#include<iostream>
#include<fstream>

using namespace std;
struct TicketInfo
{
int stampHour;
int stampMinute;
int WashOption;
};

int main()
{
ifstream FileIn;
FileIn.open("lab7.dat");
TicketInfo Customer;

TicketQueue.initializeQueue();
while(!FileIn.eof())
{
FileIn >> Customer.stampHour;
FileIn >> Customer.stampMinute;
FileIn >> Customer.WashOption;

}
cout << "Customer #  " << "Ticket Time  " << "Option  " << "Wash Time  "<<
"Start Time  " << "Finish Time  " << "Wait Time\n";

while(!TicketQueue.isEmptyQueue())
{

}

system("pause");
return 0;
}```
so I have built the queue, but stuck as to how to get a customer item from the queue and determine the wash and start times. Ive been reading through my textbooks for any references but could not find any. The functions that i need are left as an exercise in the book so no help there lol. I know i need the while loop which is empty at the moment. If anyone could offer any tips or suggestions, it will be greatly appreciated

2. Your queue needs to be based off of your customer list, e.g. your ticket info. You essentially need to make a linked list here of your customers here (your stuct), iterate through the list, then based on wash option you need to calculate stop time. The start time would be based on the last customer's stop time, if there is a wait. I think you need to refresh on Linked Lists.