In this project, you'll use a simulation to study a process. We'll use something familiar, eat in a restaurant, and simplify the model enough that we can create a simulation with the programming skills we've amassed thus far. Of course, this simplification glosses over some details, but the objective is to get experience with the idea of a simulation to analyze the time it takes for some process and do so in the context of something "real." We're interested in simulating parties of customers coming into a restaurant to eat dinner and calculating the time from when the party arrives until when the party leaves. Let's begin by considering a single party entering the restaurant. Let's also define a "server efficiency constant" for use in each trial of our simulation.

This should be used in up to 4 spots: The server comes to get the orders, the server delivers the food, the server comes to get dessert orders, and (if anyone orders dessert) delivers the dessert orders. If the server is slow, the whole dining experience takes longer. Define the "server efficiency constant" as the amount of time it takes for the server to travel to the table. Assume this time to be a constant. Suppose we have a party with some variable size (e.g. 3 people dining, 5 people dining) and the process of dining at our restaurant goes as follows and abides by the assumptions noted here: Arrival and Seating.

The party arrives at the restaurant and waits to be seated. There's some randomness in this step. Customers could be seated immediately or have to wait for a table. Define a constant for the maximum wait time and generate a random number for how long it will take until the party is seated. Seating. The party is taken to the table and given menus. Assume the host will have the appropriate number of menus ready before calling the party, thus use a constant for how long it takes to seat a party. Server Arrival and Ordering. We must first wait for the server to come to the table to take the order, so we'll factor the "server efficiency constant" in here. Let's assume that all members of the party know what food and drinks they want to order before the server arrives. Let's also assume that drinks and food are ordered at the same time to simplify our simulation.

Each person must give his/her order, so the length of time it takes to place the order depends on the number of guests in the party. Assume the amount of time it takes an individual to place his/her order is constant, though. (Let's assume that drinks and any appetizers will take less time to arrive at the table than the main food each person orders. Thus, we'll ignore these items in our simulation.) Wait for Food. Many factors come into play in determining how long it takes to prepare what each person ordered, but let's assume we can use a random number to generate the preparation time for each person's meal. Suppose the restaurant does not serve anyone's meal until food is ready for each person at the table. Define another constant for maximum food preparation time.

Then generate a random number for the time it takes to prepare each person's meal. The time it takes for the table's food to be ready, then, is the largest of the times for individual meal preparation times. Serving of Food. The server needs to bring the meal to the table. Use the "server efficiency constant" here. Eating Time. Generate a random number for how long it takes for the party to finish its meal. Again, use a constant for the upper bound of this random number. Dessert Ordering. It's possible members of the party want to order dessert. Let this be determined by random number generation as well. (Be careful: this step is different!) Assume it takes the same constant amount of time for each individual wanting dessert to order it as it took for each individual to order food. Remember, you can have 0 people that want dessert. So this will affect what happens in step 8 and 9. Wait For Dessert. This is the same as waiting for the food, except that we should use a different constant for the maximum wait time for dessert, as it generally takes less time. Also, keep in mind that not all members of the party may order dessert, so you need to count how many people want dessert in the last step and use that in this part of the simulation. Serving of Dessert. The server needs to bring the meal to the table.

Use the "server efficiency constant" here. End of Meal. Once the dessert is served, it becomes a matter of customer preferences to determine how long it takes until the parties leave. Some may eat dessert quickly and leave and others may sit and chat. The maximum time here should be different from any other step of the process, but once again, you should use a random number. A single random number will suffice for this time. Sample Simulation Trial Suppose the simulation runs like this for one example trial: Arrival and Seating: The party is seated 22 minutes after arriving.

Seating: It takes 2.5 minutes to seat the party. Note: The "server efficiency constant" is 2 minutes, i.e. it takes 2 minutes every time we need to wait for the server to do something. Server Arrival and Ordering: We wait 2 minutes for the server to arrive. Then, suppose we have 4 people in this party and the time it takes each person to order is 0.75 minutes. Thus, we waited 2 minutes for the server to arrive and 3 minutes for everyone to order, so this step took 5 minutes. Wait for Food: It takes 17 minutes for the first person's meal, 25 minutes for the second person's meal, 15 minutes for the third person's meal, and 21 minutes for the third person's meal. Therefore, it will take 25 minutes until the entire party's meals are ready to be served. Serving of Food: The "server efficiency constant" of 2 minutes must have waited until the party gets its food. Eating Time: It takes this party 20 minutes to eat their meals. Dessert Ordering. Suppose 2 of 4 people in this party want dessert. It will take each person 0.75 minutes (the constant from above) and a total of 1.5 minutes to order the desserts. Wait For Dessert. Suppose the first person's dessert takes 5 minutes to prepare and the second person's dessert takes 3 minutes to prepare. Therefore, we wait 5 minutes for the desserts to arrive. Serving of Dessert. We wait 2 minutes (“server efficiency constant”) for the dessert to arrive. End of Meal. Suppose this group stays at the table 16.2 minutes after dessert is served before leaving. Thus, it took 22 + 2.5 + 5 + 25 + 2 + 20 + 1.5 + 5 + 2 + 16.2 = 101.2 minutes from when this party arrived until it left.

Task 1: Write a program that simulates the dining experience for one party and computes the total time from when the party arrives until when it leaves. Prompt the user for the number of diners in the party and display the process on the screen as it happens. Report a total time in the end.

Task 2: Now make a new copy of the program and repeat the process for several parties who come to dine at the restaurant. The number of parties to use in the simulation should be able to change. For your debugging and initial testing purposes, I recommend using a small number, like 10, but then try a larger number of parties like 250. In addition, compute the (sample) mean of the total dining times for all parties in the simulation as you go and report this value at the end of your program. As displaying all details for 250 runs of the simulation would take up quite a bit of screen space, remove all of the intermediate outputs. Instead, create two modes to run the program in: A numeric mode, where you print out the total dining time for each party. A plotting mode, where you print out a visualization of the total dining time for each party. Each line should print one asterisk ('*') for every full five minutes past one hour. Sample Interaction for the Numeric Mode Output: This program is a simulation of dining times for parties at a restaurant. Total dining times for each trial: Trial 001: 157.043 minutes. Trial 002: 123.318 minutes.

Trial 003: 206.222 minutes. Trial 004: 168.93 minutes. Trial 005: 163.43 minutes. Trial 006: 80.3827 minutes. Trial 007: 176.766 minutes. Trial 008: 139.347 minutes. Trial 009: 195.231 minutes. Trial 010: 143.548 minutes. Average dining time among all parties in simulation: 155.422 minutes Sample Interaction for the Plotting Mode Output: This program is a simulation of dining times for parties at a restaurant. Visualization of dining times. Each '*' represents 5 minutes past 60 minutes. ------------------------------------------------ Trial 001: ******************** Trial 002: ************* Trial 003: ****************************** Trial 004: ********************** Trial 005: ********************* Trial 006: ***** Trial 007: ************************ Trial 008: **************** Trial 009: **************************** Trial 010: ***************** Average dining time among all parties in simulation: 155.422 minutes

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of