I'm not good with c++, and I'm realing stressing out about my last project.
Problem: This project deals with creating a menu-driven program that employees of the coffee shop in the university student union will use. The shop 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. The program must allow the Spot coffe employee to do the following :
a. Enter the customer coffee order (the size and number of cups).
b. At any time, show the total number of cups of each size sold up to that point.
c. At any time show the total amount (in ounces) of coffee sold up to that point.
d. At any time show the total money made up to that point.
The program must consist of at least these functions :
1. A function to present the menu choices. The choices are :
- 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 show all the data for choices 1 through 4 so far.
- 9: Enter 9 to exit the program."
2. A function to record the coffee order from the customer. This function can present the following coffee menu :
- 1: Enter 1 to buy coffee in a small cup size (9 oz)
- 2: Enter 2 to buy coffee in a medium cup size (12 oz)
- 3: Enter 3 to buy coffee in a large cup size (15 oz)
- 9: Enter 9 to exit.
3. A function to show the number of cups of each size sold.
4. A function to show the total amount of coffee sold.
5. A function to show the total money made.
This is what I have so far and I have NO clue where to go from here. Please help:
int main(void)
{
int choice;
int Size;
int ZeroCups;
system("PAUSE");
return EXIT_SUCCESS;
}
void menu()
{
cout<<"1: Enter 1 to order coffee"<<"\n";
cout<<"2: Enter 2 to check the total money made up to this time"<<"\n";
cout<<"3: Enter 3 to check the total amount of coffee sold up to this time"<<"\n";
cout<<"4: Enter 4 to check the number of cups of coffee of each size sold"<<"\n";
cout<<"5: Enter 5 to show all the data for choices 1 through 4 so far"<<"\n";
cout<<"9: Enter 9 to exit the program"<<"\n";
}
void OrderCoffee()
{
int ch=0;
menu();
}
void CupsSoldA(int CupsSoldB[3])
{
cout<<"The total number of small cups sold: "<<CupsSoldB[0]<<"\n";
cout<<"The total number of medium cups sold: "<<CupsSoldB[1]<<"\n";
cout<<"The total number of large cups sold: "<<CupsSoldB[2]<<"\n";
}
Your next step is run the menu in a loop so they can interact with it as long as they'd like.
I like to use do while loops when interacting with the user because you will always want to execute the loop at least once. If you have a case where you might not want to execute the loop at all, say if a flag is set, then you would use a while loop.
char menu()
{
int choice;
cout<<"1: Enter 1 to order coffee"<<"\n";
cout<<"2: Enter 2 to check the total money made up to this time"<<"\n";
cout<<"3: Enter 3 to check the total amount of coffee sold up to this time"<<"\n";
cout<<"4: Enter 4 to check the number of cups of coffee of each size sold"<<"\n";
cout<<"5: Enter 5 to show all the data for choices 1 through 4 so far"<<"\n";
cout<<"9: Enter 9 to exit the program"<<"\n";
cin >> choice;
return choice;
}
int choice;
do
{
choice = Menu();
} while( choice != 9 && (choice < 1 || choice > 5));