Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
The car wash machine at Squeaky Clean Car Wash requires exactly 3 minutes to complete the regular car wash (including rinse, wax, and dry). A car arrives at the car wash approximately every four minutes (cars don't arrive exactly four minutes apart: that would be easy to program!). Right now Squeaky has two car wash bay to process two cars simultaneously. The owners of the car wash are proposing to add another car wash bay, because they are suspicious that the average wait time for the cars is long enough that they are losing business. Construct a simulation of the car wash to determine the average waiting time for a car at the car wash during a typical day (9 am to 7 pm). Since the arrival time is an average, there is often a waiting line. This can be simulated using a queue as the car that entered first will be processed at first. Implement this problem using linkedlist. 

Car	Arrival Time	Processing Time   	Waiting Time
A	7		
B	6		
D	8		
E	8		
F	11		
G	12		
H	13		
I	9		
J	10		
K	9		


What I have tried:

i tried to get the result but faild,kindly help me to solve this question
Posted
Updated 14-May-20 8:53am

Show us your efforts and ask here just specific questions.
By the way, are you allowed to use the C++ standard library?
You know, it provides (for free!) a linked list[^] implementation.
 
Share this answer
 
Comments
TheRealSteveJudge 14-May-20 4:37am    
5*
KingofHeartz 2-Jun-20 6:19am    
Hello, You marked one my article as Spam. May I know what was spam in it? It was just a simple article and its source only. I don't know how you find it as spam. Because of you, my article removed and my account closed.
TheRealSteveJudge 2-Jun-20 7:37am    
Which Article do you mean? When did that happen?
The starting point is to make a UML concept of the program flow like the car wash process and the waiting queue of cars. Because you can use C++ you should use classes.

If you are allowed to use libraries than use the queue class and some string class.

Make a lot of output and write some tests. Learn the basics from some tutorial like Learn C++.
 
Share this answer
 
One tip for you : this will involve random numbers. If you use rand, and it is perfectly acceptable to do so for this, then be careful how you seed it. If you want a repeatedly "random" set of values then always use the same seed when you call srand. That is probably advisable for this problem.
 
Share this answer
 
v3
Comments
Rick York 14-May-20 14:55pm    
or is it RAND_MAX? I can't remember. I need to RTFM.
KarstenK 15-May-20 3:50am    
calling srand(time(null)) at program start should solve this issue.
Rick York 15-May-20 3:57am    
That is exactly what I was warning about. That will give a random sequence every time and might not be what they want. Seeding with the same value will give a consistent sequence every time and that might be preferred for evaluating adjustments to algorithms and parameters.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900