Question
Your neighbor has been planning to open a Diner and requests your help to come up with some estimates on quantity of food stock he
Your neighbor has been planning to open a Diner and requests your help to come up with some estimates on quantity of food stock he will need, and income he will be able to generate. From his market research of neighborhood-diners, he has collected some data. He wants you to use this data and develop a simulation program that projects his potential daily income. His study has shown that the guests belong usually to one of the four categories: Families, Individuals, Groups, or Couples. Further, each of these categories usually places order in the quantities shown in the table below.
Table 1: Order quantities
Guest type | Drink | Soup | Salad | Entree | Dessert |
Family | 4 | 2 | 3 | 4 | 2 |
Couple | 2 | 1 | 1 | 2 | 1 |
Individual | 1 | 1 |
| 1 |
|
Group | 4 | 3 | 3 | 4 | 3 |
The guests arrive in a random order, which means the next guest can be a family, a couple, an individual or a group. You recently learned about Random class and polymorphism. So use these concepts in the following way. Use the Random class to generate a number from 0 to 3 for the four types of guests. Based on the generated number, you make the guest to be one of the four types. The food order will be placed and the kitchen stock will be reduced accordingly. The program should stop as soon as any item-stock reaches or drops below 4 servings. The opening stock for kitchen and item-rate card are in Table 2.
Table 2: Kitchen stock and Rate card
Item | Kitchen opening stock | Rate card $/serving |
Drink | 120 servings | $2 |
Soup | 75 servings | $3 |
Salad | 75 servings | $5 |
Entree | 120 servings | $7 |
Dessert | 65 servings | $4 |
Once the program stops, it should calculate and print the following:
Total income of the day
No. of different guest types who were served
Total no. of guests
Closing stock of soup, salad etc.
Here is what the program should print
First run:
******* Total income for the day: $1,679 *********
** Guest type count ** Family: 7
Couple: 10
Individual: 17
Group: 10
******** Total number of orders: 44 *********
** Closing stock **
Drink: 15
Soup: 4
Salad: 14
Entree: 15
Dessert: 11
Second run:
******* Total income for the day: $1,819 *********
** Guest type count ** Family: 11
Couple: 12
Individual: 8
Group: 9
******** Total number of orders: 40 *********
** Closing stock **
Drink: 8
Soup: 6
Salad: 3
Entree: 8
Dessert: 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started