Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- char order;
- double coffee = 2.0, tea = 1.25, hotChoco = 3.50, cappu = 3.50;
- int cups;
- double totalPrice = 0;
- const double tax = 1.09;
- int count = 1;
- cout << "Hot Beverage Menu" << endl;
- cout << "A: Coffee $2.00" << endl;
- cout << "B: Tea $1.25" << endl;
- cout << "C: Hot Chocolate $1.75" << endl;
- cout << "D: Cappuccino $3.50" << endl;
- cout << "Enter the beverage A,B,C or D you wish to order" << endl;
- cout << "Enter E to exit the program" << endl;
- while(count==1){
- cout << "Which one do you want to order?(A,B,C,D)" << endl;
- cin >> order;
- switch(order) {
- case 'A':
- cout << "How many cups do you want?" << endl;
- cin >> cups;
- totalPrice += (double)coffee*cups*tax;
- cout << "Your current total price is $" << totalPrice << endl;
- continue;
- case 'B':
- cout << "How many cups do you want?" << endl;
- cin >> cups;
- totalPrice += (double)tea*cups*tax;
- cout << "Your current total price is $" << totalPrice << endl;
- continue;
- case 'C':
- cout << "How many cups do you want?" << endl;
- cin >> cups;
- totalPrice += (double)hotChoco*cups*tax;
- cout << "Your current total price is $" << totalPrice << endl;
- continue;
- case 'D':
- cout << "How many cups do you want?" << endl;
- cin >> cups;
- totalPrice += (double)cappu*cups*tax;
- cout << "Your current total price is $" << totalPrice << endl;
- continue;
- case 'E':
- cout << "your total price is $" << totalPrice << endl;
- cout << "Thanks for your order. Please come again!" << endl;
- count = -1;
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement