Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.13 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     char order;
  6.     double coffee = 2.0, tea = 1.25, hotChoco = 3.50, cappu = 3.50;
  7.     int cups;
  8.     double totalPrice = 0;
  9.     const double tax = 1.09;
  10.     int count = 1;
  11.    
  12.     cout << "Hot Beverage Menu" << endl;
  13.     cout << "A: Coffee $2.00" << endl;
  14.     cout << "B: Tea $1.25" << endl;
  15.     cout << "C: Hot Chocolate $1.75" << endl;
  16.     cout << "D: Cappuccino $3.50" << endl;
  17.     cout << "Enter the beverage A,B,C or D you wish to order" << endl;
  18.     cout << "Enter E to exit the program" << endl;
  19.    
  20.     while(count==1){
  21.         cout << "Which one do you want to order?(A,B,C,D)" << endl;
  22.         cin >> order;
  23.         switch(order) {
  24.                 case 'A':
  25.                     cout << "How many cups do you want?" << endl;
  26.                     cin >> cups;
  27.                     totalPrice += (double)coffee*cups*tax;
  28.                     cout << "Your current total price is $" << totalPrice << endl;
  29.                 continue;
  30.                 case 'B':
  31.                     cout << "How many cups do you want?" << endl;
  32.                     cin >> cups;
  33.                     totalPrice += (double)tea*cups*tax;
  34.                     cout << "Your current total price is $" << totalPrice << endl;
  35.                 continue;
  36.                 case 'C':
  37.                     cout << "How many cups do you want?" << endl;
  38.                     cin >> cups;
  39.                     totalPrice += (double)hotChoco*cups*tax;
  40.                     cout << "Your current total price is $" << totalPrice << endl;
  41.                 continue;
  42.                 case 'D':
  43.                     cout << "How many cups do you want?" << endl;
  44.                     cin >> cups;
  45.                     totalPrice += (double)cappu*cups*tax;
  46.                     cout << "Your current total price is $" << totalPrice << endl;
  47.                 continue;
  48.                 case 'E':
  49.                     cout << "your total price is $" << totalPrice << endl;
  50.                     cout << "Thanks for your order. Please come again!" << endl;
  51.                     count = -1;
  52.                 break;
  53.         }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement