Hello! I have torn this website apart looking for help, but nothing has. I am currently in my first computer science class at uni, and I need help with this lab we are doing!
Here is the prompt:
Janice is starting a coffee shop in your town, and she has heard of your programming expertise. She is wanting you to develop a program that can help her keep track of cups of coffee she will sell at her store. The program must be able to accomplish the following:
1. Record/Sell a cup of coffee of the following sizes:
a. 9 fl oz: $1.75
b. 12 fl oz: $1.90
c. 15 fl oz: $2.00
2. Keep track of the total number of each type of cup sold.
3. Calculate the total amount of coffee sold in gallons.
a. 1 gallon = 128 fl oz
4. Calculate the total profits the store has made from the sale of coffee.
Note: Global variables (other than constants) are NOT permitted in this program. The creation and use of global variables will result in penalties.
I have been working for 2 days straight on this code, and I've come up short and am in need of any sort of help! Please let me know what you'd suggest I do or any changes I can make!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
#include <iostream>
#include <iomanip>
using namespace std;
void showMenu (){
cout << " Coffee Shop Main Menu: " << endl;
cout << " 1. Purchase a cup of coffee" << endl;
cout << " 2. Display total number of cups of each size were sold" << endl;
cout << " 3. Diplay total amount of coffee sold" << endl;
cout << " 4. Display total shop profits" << endl;
cout << " 5. Exit" << endl;
}
int main()
{
// purchase, total cups, amount of coffee, profit
int choice;
int cupChoice;
int small;
int medium;
int large;
do{
showMenu();
cout << "Please choose an option."<< endl;
cin >> choice;
switch(choice){
case 1:
cout << " Which cup would you like to purchase? " << endl;
cout << "1. Small (9oz): $1.75" << endl;
cout << "2. Medium (12oz): $1.90" << endl;
cout << "3. Large (15oz): $2.00" << endl;
cin >> cupChoice;
cout << "Thank you for your purchase!" << endl;
break;
case 2:
break;
|
I know that I'll need cases for each menu option, but I am a little confused on how to get there. So far, this much of the code works. I need help with basically option 2 - 4. The end of my do while loop will end the program.