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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cctype>
using namespace std;
double smallSize = 9, mediumSize = 12, largeSize = 15; //in OZ
double smallPrice = 1.75, mediumPrice = 1.90, largePrice = 2.00; //in $0.00
void sellCoffee(int &smallCups, int &mediumCups, int &largeCups)
{
char size = 0;
int numOfCups = 0;
cout << "Enter '$' at any time to return to the main menu." << endl;
while (size != '$')
{
cout << "What size cup do you want? (S, M, L,)" << endl;
cin >> size;
cout << "How many cups do you want?" << endl;
cin >> numOfCups;
if (islower(size))
{
size = toupper(size);
}
switch (size)
{
case 'S': smallCups = smallCups + numOfCups;
break;
case 'M': mediumCups = mediumCups + numOfCups;
break;
case 'L': largeCups = largeCups + numOfCups;
break;
case '$':
return;
default: cout << "Invalid option..." << endl;
break;
}
}
}
void reportCups(int &smallCups, int &mediumCups, int &largeCups)
{
/*int totalSold = 0;
totalSold = &smallCups + &mediumCups + &largeCups;
cout << "Total Cups Sold" << endl;
cout << "-------------------" << endl;
cout << left << "Small Cups: " << &smallCups << endl;
cout << left << "Medium Cups: " << &mediumCups << endl;
cout << left << "Large Cups: " << &largeCups << endl;
cout << left << "Total Sold: " << totalSold << endl;*/
}
void reportOunces(int &smallCups, int &mediumCups, int &largeCups)
{
}
void reportRevenue(int &smallCups, int &mediumCups, int &largeCups)
{
}
int main()
{
int smallCups = 0, mediumCups = 0, largeCups = 0;
int userChoice = 0;
cout << "Please, select a menu option (1-5). " << endl << endl;
cout << "1. Sell Coffee" << endl << endl;
cout << "2. Cups Report" << endl << endl;
cout << "3. Ounces Report" << endl << endl;
cout << "4. Revenue Report" << endl << endl;
cout << "5. Help" << endl << endl;
while (userChoice >= 1 || userChoice <= 5 && userChoice != 6)
{
switch (userChoice)
{
case 1: sellCoffee(smallCups, mediumCups, largeCups);
break;
case 2: reportCups(smallCups, mediumCups, largeCups);
break;
case 3: reportOunces(smallCups, mediumCups, largeCups);
break;
case 4: reportRevenue(smallCups, mediumCups, largeCups);
break;
case 5: cout << "To use this program simply choose a number (1-5)." << endl;
cout << "Entering a '$' within the sub-menus will return you to the main menu." << endl;
cout << "Entering a '6' will end the program." << endl;
break;
return 0;
default: cout << "Invalid choice..." << endl;
}
cin >> userChoice;
}
system("pause");
return 0;
}
|