Answer to Question #28010 in C++ for rousan

Question #28010
In a CS115 Café there are three drinks to order (coffee, juice, and tea), write a complete c++ program to show a menu then prompt users to enter 1 for Tea, 2 for Coffee, 3 for juice, -1 to exit without choosing any drink. They have the choice to choose more than one choice.

When the user done from choosing the program will calculate his bill (فاتورة) (total bill is the summation of all prices of all drinks chosen by the user.)
Once the total bill has been calculated the bill will be issued for the user after adding the tax that is equal 16%.
Expert's answer
# include <iostream>
using namespace std;

int outMenu(){
cout<<"enter\n1 for Tea 2$\n2 for Coffee 3$\n3 for juice 4$\n-1 to exit\n";
int ch;
return ch;

int main(){
int ch;
double sum = 0;

ch = outMenu();
switch (ch){
case 1: sum+=2*1.16; cout<<"Tea added\n"; break;
case 2: sum+=3*1.16; cout<<"Cofee added\n"; break;
case 3: sum+=4*1.16; cout<<"Juice added\n"; break;
case -1 : cout<<"Bill : "<<sum<<endl; break;
default: cout<<"wrong input, try again!\n";
if (ch == -1) break;

return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog