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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
|
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int cupSmall (0), sizeSmall (0), choice (0),
cupMedium (0), sizeMedium (0), quantity (0),
cupLarge (0), sizeLarge (0);
double priceSmall (0),
priceMedium (0),
priceLarge (0);
while (true)
{
system("cls"); // Not cross-platform
// Display Menu
cout << "\n\n\n\n\n\t\t| Welcome to Jason's Cafe |\n\n"
<< "\n\t1. Sell Coffee."
<< "\n\t2. Total number of coffee sold [in cups]"
<< "\n\t3. Total amount of coffee sold [in ounces]"
<< "\n\t4. Total Sales."
<< "\n\t5. Tutorial [How to use this program]"
<< "\n\t6. Exit"
<< "\n\n\n\t- Enter your choice [1 - 6]: ";
cin >> choice;
// Input Validation
while ( cin.bad() || choice < 1 || choice > 6 )
{
cout << "\t- Invalid Option. Enter your choice again: ";
cin.clear();
cin.ignore(1000, '\n');
cin >> choice;
} // End of Input Validation
// 1. Sell Coffee
if (choice == 1)
{
system("cls");
do
{
cout << "\n\n\n\n\n | Size || Quantity || Price |"
<< "\n\n 1. Small (9oz) $1.75"
<< "\n 2. Medium (12oz) $1.90"
<< "\n 3. Large (15oz) $2.00"
<< "\n\n 4. Go to Main Menu"
<< "\n 5. Exit Program"
<< "\n\n\n\n - Select Your option [1 - 5]: ";
cin >> choice;
// Input Validation
while ( cin.fail() || choice < 1 || choice > 5 )
{
cout << " - Invalid Option. Enter your choice again: ";
cin.clear();
cin.ignore(1000, '\n');
cin >> choice;
} // End of Input Validation
if ( choice == 1 || choice == 2 || choice == 3 )
{
cout << "\n\n - Enter quantity: ";
cin >> quantity;
// Input Validation
while ( cin.fail() || quantity <= 0 )
{
cout << " - Invalid Quantity. Enter your quantity again: ";
cin.clear();
cin.ignore(1000, '\n');
cin >> quantity;
} // End of Input Validation
}
// 1. Small Coffee
if ( choice == 1 )
{
cupSmall += quantity;
sizeSmall += 9 * quantity;
priceSmall += 1.70 * quantity;
cout << "\n\n\n\n\n\t------------------------------------------"
<< "\n\t " << quantity << " small coffee(s) @ 1.70/cup"
<< "\n\t Thank you..."
<< "\n\t------------------------------------------\n\n\n\n\n\t";
system("pause");
break;
} // End of 1. Small
// 2. Medium Coffee
else if ( choice == 2 )
{
cupMedium += quantity;
sizeMedium += 12 * quantity;
priceMedium += 1.90 * quantity;
cout << "\n\n\n\n\n\t------------------------------------------"
<< "\n\t " << quantity << " medium coffee(s) @ 1.90/cup"
<< "\n\t Thank you..."
<< "\n\t------------------------------------------\n\n\n\n\n\t";
system("pause"); // Not cross-platform
break;
} // End of 2. Medium Coffee
// 3. Large Coffee
else if ( choice == 3 )
{
cupLarge += quantity;
sizeLarge += 15 * quantity;
priceLarge += 2.00 * quantity;
cout << "\n\n\n\n\n\t------------------------------------------"
<< "\n\t " << quantity << " large coffee(s) @ 2.00/cup"
<< "\n\t Thank you..."
<< "\n\t------------------------------------------\n\n\n\n\n\t";
system("pause");
break;
} // End of 3. Large Coffee
// Go to main menu
else if ( choice == 4 ) break;
// Exit program
else return 0;
} while ( choice );
} // End of 1. Sell Coffee
// 2. Total number of coffee sold [in cups]
else if ( choice == 2 )
{
system("cls");
cout << "\n\n\n\n\n\t- Total number of coffee sold [in cups] : "
<< cupSmall + cupMedium + cupLarge << " Cups.\n\n\t"
<< cupSmall << "\tSmall cup(s)\n\t"
<< cupMedium << "\tMedium cup(s)\n\t"
<< cupLarge << "\tLarge cup(s)\n\n\n\t";
system("pause");
} // End of 2. Total number of coffee sold [in cups]
// 3. Total amount of coffee sold [in ounces]
else if ( choice == 3 )
{
system("cls");
cout << "\n\n\n\n\n\t- Total amount of coffee sold [in ounces] : "
<< sizeSmall + sizeMedium + sizeLarge << " Ounces.\n\n\t"
<< cupSmall << "\t9oz Coffee\n\t"
<< cupMedium << "\t12oz Coffee\n\t"
<< cupLarge << "\t15oz Coffee\n\n\n\t";
system("pause");
} // End of 3. Total amount of coffee sold [in ounces]
// 4. Total Sales
else if ( choice == 4 )
{
system("cls");
cout << "\n\n\n\n\n\t- Total Sales [in amount] : $" << fixed << setprecision(2)
<< priceSmall + priceMedium + priceLarge << "\n\n\t"
<< cupSmall << "\tSmall Coffee [1.70/cup]\n\t"
<< cupMedium << "\tMedium Coffee [1.90/cup]\n\t"
<< cupLarge << "\tLarge Coffee [2.00/cup]\n\n\n\t";
system("pause");
} // End of 4. Total Sales
// 5. Tutorial [How to use this program]
else if ( choice == 5 )
{
system("cls");
cout << "\n\n\n\t\t| Tutorial |"
<< "\n\n\tYour Tutorial information goes here...\n\n\n\t";
system("pause");
} // End of 5. Tutorial [How to use this program]
// 6. Exit Program
else return 0;;
} //while ( choice ); // Go back to main menu, until user enters 6 to exit the program
} // End of main ()
// End of Program.
|