Simulation

• 12-09-2002
CodeJerk
Simulation
I am doing a computer simulation, where I have to simulate cars coming into a car wash. 1 car comes in 4 minutes on an average. On a given day not more that 150 cars come into the wash. How do I simulate this in my program, that is, in a particular minute 1/2/3/4 cars may come in, but the distribution converges to 150 in a way to give an average of around .25 (4 cars in a minute) . Please help.....
Thankx
• 12-09-2002
kuphryn
Are you working on a final project for an OOP C++ class? There are several solutions. I recommend that you push the limit and design the program with respect to independent objects including cars and car washing machine(s). A car enters the car wash at random time. Here is a simple design.

- Given: simulation lasts 30 days; 1 car enters every 1 minute
- calculate total cars for 30 interval (Poisson distribution)
- create a queue with X number of cars. In this case, the queue is of type double (time). Each element is the arrival time of each car.
- There will be at least four threads.