A few years ago I attended an indoor track meet that took place in a newly built warehouse. This warehouse did not have any indoor plumbing so the meet coordinators brought in outhouses for the athletes to use. The problem was that they did not have enough outhouses, and consequently, the outhouse lines were ridiculously long. Your goal is to develop a simulation to help gauge the proper number of outhouses needed for various events.
Input Information
Arrival Rate - This value represents the likelihood of a group arriving for the outhouses in a given minute of the simulation expressed as a percentage. If the Arrival Rate was 25%, for instance, this means that there is a 25% likelihood that a group will arrive to use an outhouse in a given minute of the simulation.
Avg Group Size - This value represents the average group size that arrives at the outhouse together in a minute run of the simulation. The program randomly select a number from 1 through the (average group size)*2-1 to add to the queue when a group arrives. If the average group size is 2, for instance, the program randomly add 1 through 3 people to the queue.
Avg Process Time - This value represents the average amount of time, expressed in minutes, that a person occupies an outhouse. The program randomly selects a number from 1 through the (average process time)*2-1 for the average process time.
Number of Outhouses - This value represents the number of outhouses to use in the simulation.
Output Information
Throughput - The total number of people who used the outhouse (entered AND left).
Avg Wait - The average wait time for the people who used the outhouse (entered AND left).
Line Size - The current size of the line to use the outhouse.
Current Time - The current minute time of the simulation.
Here is a basic algorithm that you may want to follow:
in each minute of the simulation (i.e. when the paintComponent method of the DrawingPanel is called) for all the outhouses remove any person who is finished update throughput and the accumulating total wait time if a new group arrives randomly determine group size for each person in the group randomly determine process time time stamp and add the person to the waiting queue line if an outhouse is open and the waiting queue line is not empty remove a person from the waiting queue line for all the outhouses reduce by 1 minute the time left before they are finished
In order to make this simulation visual, I am going to provide you with a GUI application to integrate your code into.