144k views
0 votes
Jason opened a coffee shop at the beach and sells coffee in three sizes: small (9oz), medium (), 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:

1. Buy coffee in any size and in any number of cups.
2. Show the total number of cups of each size sold at any time.
3. Show the total amount of coffee sold.
4. 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 (option 1).

c) A function to check the total money made (option 2).

d) A function to check the total amount of coffee sold (option 3).

e) A function to check the number of cups of coffee of each size sold (option 4).

f) A function that prints the data (option 5).

Your program should not use global variables. Special values such as coffee cup sizes and cost of a coffee cup must be declared as named constants.

1 Answer

1 vote

Final answer:

The student needs to write a menu-driven program for operating a coffee shop that allows purchasing coffee in various sizes and keeping track of sales and revenue without using global variables, with constants for sizes and prices.

Step-by-step explanation:

The student is asked to create a menu-driven program for a coffee shop. This program should allow the user to purchase coffee in different sizes and track the sales and revenue. The task involves writing functions to handle various operations such as printing the menu, processing orders, and showing sales and money statistics.

Here are the key elements of the program:

  • Menu Printing Function - Displays size options and pricing.
  • Order Function - Takes user input for coffee size and quantity, calculates cost.
  • Total Money Function - Computes and shows total revenue from sales.
  • Total Coffee Sold Function - Displays total ounces of coffee sold.
  • Cups Sold Function - Shows the number of cups sold by size.
  • Data Printing Function - A summary of all the above data.

Constants should be used for the coffee sizes and prices. No global variables are to be used throughout the program.

User Matt Hammond
by
8.5k points