Jason opened a coffee shop at the mall and sells coffee in three sizes: small (9
ID: 3676582 • Letter: J
Question
Jason opened a coffee shop at the mall 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 provide the following menu options:
1: Enter 1 to order coffee.
2: Enter 2 to check the total money made up to this time.
3: Enter 3 to check the total amount of coffee sold up to this time.
4: Enter 4 to check the number of cups of coffee of each size sold.
5: Enter 5 to print all the data.
9: Enter 9 to exit the program.
Your program should consist of at least the following functions: (10pts each)
- A function to show the user how to use the program. ( void menu() )
- A function to show the number of cups of each size sold. ( void showCupCount(int s, int m, int l) )
- A function to show the total money made. ( void showMoneyMade(double m) )
- A function to show the total amount of coffee sold. ( void showCoffeeSold(int c) )
- A function to sell the coffee.
void sellCoffee(int& sCupCount, int &mCupCount, int& lCupCount, int& totalCoffeeSold, double& tMoneyMade)
Program successfully runs and provides an option to Exit.
//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
//Deadline is in an hour, please help! Please use only basic pass by reference/value.
Explanation / Answer
#include <iostream>
using namespace std;
int tmoney=0,tcofee=0,tsc=0,tmc=0,tlc=0;
void menu()
{
cout<<"Enter 1 to order coffee. ";
cout<<"Enter 2 to check the total money made up to this time. ";
cout<<"Enter 3 to check the total amount of coffee sold up to this time. ";
cout<<"Enter 4 to check the number of cups of coffee of each size sold. ";
cout<<"Enter 5 to print all the data. ";
cout<<"Enter 9 to exit the program. ";
}
void showcupcount(int s,int m,int l)
{
cout<<"Total number of small cups "<<s;
cout<<"Total number of medium cups "<<m;
cout<<"Total number of large cups "<<l;
}
void showmoneymade(double m)
{
cout<<"Total money made : "<<m;
}
void showcoffesold(int c)
{
cout<<"Total coffe sold "<<c;
}
void printdata()
{
cout<<"Total number of small cups "<<tsc;
cout<<"Total number of meduim cups "<<tmc;
cout<<"Total number of large cups "<<tlc;
cout<<"Total Money made: "<<tmoney;
cout<<"Total Coffee Sold "<<tcofee;
}
void sellcoffee(int &scupcount,int &mcupcount,int &lcupcount,int &tcoffeesold,int &tmoneymade)
{
cout<"Cofee Sold ";
}
int main() {
int ch;
int scupcount_new,mcupcount_new,lcupcount_new;
int tcoffeesold_new,tmoneymade_new;
menu();
cin>>ch;
if(ch==1)
{
cout<<"Enter the number of Small cups: ";
cin>>scupcount_new;
cout<<"Enter the number of medium cups: ";
cin>>mcupcount_new;
cout<<"Enter the number of large cups: ";
cin>>lcupcount_new;
tcoffeesold_new=scupcount_new*9+mcupcount_new*12+lcupcount_new*15;
tmoneymade_new=scupcount_new*1.75+mcupcount_new*1.90+lcupcount_new*2.0;
sellcoffee(scupcount_new,mcupcount_new,lcupcount_new,tcoffeesold_new,tmoneymade_new);
tmoney=tmoney+tmoneymade_new;
tcofee=tcofee+tcoffeesold_new;
tsc=tsc+scupcount_new;
tmc=tmc+mcupcount_new;
tlc=tlc=lcupcount_new;
}
else if(ch==2)
{
showcupcount(tsc,tmc,tlc);
}
else if(ch==3)
{
showcoffesold(tcofee);
}
else if(ch==4)
{
showmoneymade(tmoney);
}
else if(ch==5)
{
printdata();
}
else if(ch==9)
{
return 0;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.