CODE MEAL NAME PRICE (RM)
1 Chicken Fillet 15.00
2 Roasted Beef 20.00
3 Rib eye Fillet 30.00
CODE BEVERAGE NAME PRICE (RM)
S Syrup 1.50
L Lychee 2.80
C Coconut 3.50
i. The customer order the meal and beverage based on the code
ii. system will ask the quantity for each order
iii. displays the quantity and the total price of the meal
iv. displays the quantity and the total price of the beverage
v. displays the total price that the user needs to pay
vi. The system will repeat the process i to v until user put ‘N’ to stop the program
SAMPLE OUTPUT :
CODE MEAL NAME PRICE(RM)
1 Chicken fillet 15.00
2 Roasted Beef 20.00
3 Rib eye fillet 30.00
Enter your meal code: 2
Enter quantity for the meal: 5
#include <iostream>
using namespace std;
int gettotal(float m,int q){
return (m*q);
}
int main()
{
int total=0;
while(true){
cout<<"1 Chicken fillet 15.00 \n2 Roasted Beef 20.00 \n3 Rib eye fillet 30.00\n";
int ch;
cout<<"\nEnter your meal code:";
cin>>ch;
int quantity;
cout<<"\nEnter quantity for the meal:";
cin>>quantity;
if (ch==1){
total=total+gettotal(15.00,quantity);
}
else if (ch==2){
total=total+gettotal(20.00,quantity);
}
else if (ch==3){
total=total+gettotal(30.00,quantity);
}
cout<<"\ntotal: "<<total<<endl;
string ch2;
cout<<"\nContinue?";
cin>>ch2;
if (ch2=="N")
break;
}
return 0;
}
Comments
Leave a comment