This whole project i have to create is "A high-end coffee shop has just hired you as their senior programmer. They have tasked you to design and implement two C++ applications allowing employees to take orders from its customers and to determine weekly sales.
Application #1: Create an application allowing employees to take orders and then tally up the total costs from its customers.
The coffee shop offers the following items on its menu:
• Coffee
• Tea
• Soda
• Juice
• Manager Special (store manager offers a drink of their choice to customers)
The application must be able to:
• Accept one or more drinks in a single order; use a sentinel value to terminate an order
• Once an order has been placed, tally up the total cost of the order"
I have created a code that displays the prices of the drinks and allows me to input the variable to keep going adding the totals, but once I input the file the program gives me a run-time error,I have changed things and they I end up getting different errors, or not completing what the program actually wants to do. I'm stuck please guide me where my error is made. Thank you
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
|
// project 4 - Juan Maraboli 3/27/16
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int number;
float cost;
char beverage;
bool validBeverage;
cout << fixed << showpoint << setprecision(2);
do
{
cout << endl << endl;
cout << "Welcome to My Coffee Shop! Our Offers are:" << endl;
cout << "C: Coffee $1.29" << endl;
cout << "J: Juice $1.50" << endl;
cout << "S: Soda $1.00" << endl;
cout << "T: Tea $1.39" << endl;
cout << "M: Manager Special $2.99" << endl;
cout << "X: Done with Placing Oder" << endl;
cout << "What drink would you like? Select C, J, S, T, M (or X to finish with order)" << endl;
cin >> beverage;
switch (beverage)
{
case 'c':
case 'C':
case 'j':
case 'J':
case 's':
case 'S':
case 't':
case 'T':
case 'm':
case 'M':validBeverage = true;
break;
default: validBeverage = false;
}
if (validBeverage)
{
// Fill in the code to begin a switch statement
// that is controlled by beverage
switch (beverage)
{
case 'c':
case 'C': cost = cost + 1.29;
cout << "Thank you, You have ordered coffee as your drink" << endl;
break;
// Fill in the code to give a case for tea ($.75 a cup)
case 'j':
case 'J': cost = cost + 1.50;
cout << "The total cost is $ " << endl;
break;
// Fill in the code to give the case for hot chocolate ($1.25 a cup)
case 't':
case 'T': cost = cost + 1.39;
cout << "The total cost is $ " << endl;
break;
// Fill in the code to give the case for cappuccino ($2.50 a cup)
case 's':
case 'S': cost = cost + 1.00;
cout << "The total cost is $ " << cost << endl;
break;
case 'm':
case 'M': cost = cost + 2.99;
cout << "The total cost is $ " << cost << endl;
break;
case 'x':
case 'X': cout << " Please come again" << endl;
break;
// Fill in the code to write a message
// indicating an invalid selection.
default:
cout << "Invalid selection" << endl;
cout << " Try again please" << endl;
}
}
} // Fill in the code to finish the do-while statement with the
// condition that beverage does not equal E or e.
while ((beverage != 'x') || (beverage != 'X'));
// Fill in the appropriate return statement
return 0;
}
|
Thanks for your input and help.