Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Jason opened a coffee shop at the beach and sells coffee in three sizes: small (

ID: 3764975 • Letter: J

Question

Jason opened a coffee shop at the beach and sells coffee in three sizes: small (9 oz), medium (12 oz), and large (15 oz). 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 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 atleast the following functions; a function to show the user how to use the program a function to show the number of cups of each size sold, a function to show the total amount of coffee sold, and a function to show the total money made. 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. . [PS: The program will be graded on the following: 1) It should work correctly as per the specification 2) Appropriate naming of variables 3) Using named constant 4) Correct display of the result as per specification.] (computer programming C++)

Explanation / Answer

#include <iostream>
#include <iomanip>
using namespace std;
const double SMALL_CUP_COST = 1.75;
const double MEDIUM_CUP_COST = 1.90;
const double LARGE_CUP_COST = 2.00;
char choice;
void tutorial(int & small, int & medium, int & large);
void sales(int & small, int & medium, int & large);
void sizesSold(int & small, int & totalSmall, int & medium, int & totalMedium, int & large, int & totalLarge);
void totalCupsSold(int & totalSmall, int & totalMedium, int & totalLarge);
void totalSales(int & totalSmall, int & totalMedium, int & totalLarge);
int main()
{
int small;
int medium;
int large;
int totalSmall;
int totalMedium;
int totalLarge;
tutorial(small, totalSmall, medium, totalMedium, large, totalLarge);
system("pause");
return 0;
}
void initialize(int & small, int & medium, int & large)
{
small = 0;
medium = 0;
large = 0;
}
void tutorial(int & small, int & totalSmall, int & medium, int & totalMedium, int & large, int & totalLarge)
{
cout << "Please select which option you would like." << endl;
cout << "1. Buy Coffee" << endl;
cout << "2. Display the cups of coffee of each size sold" << endl;
cout << "3. Display the total cups of coffee sold" << endl;
cout << "4. Display the total amount of money earned" << endl;
cin >> choice;
switch (choice)
{
case '1':
sales(small, medium, large);
break;
case '2':
sizesSold(small, totalSmall, medium, totalMedium, large, totalLarge);
break;
case '3':
totalCupsSold(totalSmall, totalMedium, totalLarge);
break;
case '4':
totalSales(totalSmall, totalMedium, totalLarge);
break;
default:
cout << "Invalid number selection. Please select a number between 1 and 4." << endl;
}
}
void sales(int & small, int & medium, int & large)
{
initialize(small, medium, large);
cout << "Please read the menu, and select the number " << endl;
cout << "of each size of coffee that you would like to " << endl;
cout << "purchase. If you would not like to purchase a certain " << endl;
cout << "size of coffee, please enter '0'." << endl << endl;
cout << "Small Cup........................ $" << showpoint << setprecision(3) << SMALL_CUP_COST << endl;
cout << "Medium Cup....................... $" << showpoint << setprecision(3) << MEDIUM_CUP_COST << endl;
cout << "Large Cup........................ $" << showpoint << setprecision(3) << LARGE_CUP_COST << endl;
cout << "Please enter the number of small cups you would like to purchase: ";
cin >> small;
cout << endl;
cout << "Please enter the number of medium cups you would like to purchase: ";
cin >> medium;
cout << endl;
cout << "Please enter the number of large cups you would like to purchase: ";
cin >> large;
cout << endl;
}
void sizesSold(int & small, int & totalSmall, int & medium, int & totalMedium, int & large, int & totalLarge)
{
totalSmall = totalSmall + small;
totalMedium = totalMedium + medium;
totalLarge = totalLarge + large;
cout << "Number of small cups of coffee sold: " << totalSmall << endl;
cout << "Number of medium cups of coffee sold: " << totalMedium << endl;
cout << "Number of large cups of coffee sold: " << totalLarge << endl;
}
void totalCupsSold(int & totalSmall, int & totalMedium, int & totalLarge)
{
int totalCoffeeSold = totalSmall + totalMedium + totalLarge;
cout << "The total number of coffee cups sold is: " << totalCoffeeSold << endl;
}
void totalSales(int & totalSmall, int & totalMedium, int & totalLarge)
{
double moneyMade = (SMALL_CUP_COST * totalSmall) + (MEDIUM_CUP_COST * totalMedium) + (LARGE_CUP_COST * totalLarge);
cout << "Total Sales are: " << showpoint << moneyMade << endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote