40.5k views
5 votes
Jason opened a coffee shop at the beach and sells coffee in three sizes: small (9oz), medium (12oz), and large (15oz). The cost of one small cup is $1.75, one medium cup is $1.90, and one large cup is $2.00. Write a menu-driven program that will make the coffee shop operational. Your program should allow the user to do the following: - Buy coffee in any size and in any number of cups. - At any time show the total number of cups of each size sold. - At any time show the total amount of coffee sold. - At any time show the total money made. Your program should consist of at least the following functions: a. a function to print the menu

b. a function to order the coffee
c. a function to check the total money made up
d. a function to check the total amount of coffee sold up
e. a function to check the number of cups of coffee of each size sold
f. a function that print the data
Your program should not use any global variables and special values such as coffee cup sizes and cost of a coffee cup must be declared as named constants.

User Gvb
by
7.2k points

1 Answer

3 votes

Final answer:

To make the coffee shop operational, you can create a menu-driven program in a programming language such as Python. The program should include functions for printing the menu, ordering coffee, checking the total money made, checking the total amount of coffee sold, checking the number of cups of each size sold, and printing the data. You can use named constants for the sizes and prices of the cups of coffee.

Step-by-step explanation:

To make the coffee shop operational, I would recommend creating a menu-driven program in a programming language such as Python. Here is an example of how you can structure your program:

  1. Define named constants for the sizes and prices of the cups of coffee.
  2. Create a function to print the menu, which displays the available sizes and prices.
  3. Create a function to order the coffee, which prompts the user for the size and quantity of cups they want to buy. Calculate the total cost of the order and update the total number of cups sold for each size.
  4. Create a function to check the total money made, which calculates the sum of the costs of all orders.
  5. Create a function to check the total amount of coffee sold, which calculates the sum of the sizes of all cups sold.
  6. Create a function to check the number of cups of coffee of each size sold, which displays the current count of cups sold for each size.
  7. Create a function to print the data, which calls the other functions as needed to display the relevant information.

You can then use a loop to repeatedly display the menu and handle user inputs until they choose to exit the program. In the loop, you can call the appropriate function based on the user's choice.

User Dobby Dimov
by
7.3k points