0% found this document useful (0 votes)
23 views2 pages

CS201 Assignment 1 Solution Fall 2011

This C++ program simulates a virtual restaurant by prompting the user to enter a meal price, calculating the applicable sales tax, displaying the total amount, and recommending an appropriate dessert based on the total amount. It then prompts the user to process another customer or exit the program.

Uploaded by

Owais Khan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views2 pages

CS201 Assignment 1 Solution Fall 2011

This C++ program simulates a virtual restaurant by prompting the user to enter a meal price, calculating the applicable sales tax, displaying the total amount, and recommending an appropriate dessert based on the total amount. It then prompts the user to process another customer or exit the program.

Uploaded by

Owais Khan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS201 Assignment 1 Solution Fall 2011

#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { cout"***Virtual Resturent***\n\n"; int price; cout "Enter the price of the meal:"; cin >> price; float saleTax; if(price<=100) { saleTax = 0.0 * price; } else if(price <= 200) { saleTax = 0.1 * price; } else { saleTax = 0.2 * price; } cout"\nPrice of Meal:\t"price; cout"\nSales Tax:\t"saleTax; cout"\n....................."; float totalAmount; totalAmount = price + saleTax; cout "\nTotal Amount\t" totalAmount; if (totalAmount<1000) { cout"\n\nThis customer should be served with Candies"; } else if(totalAmount>=1000&&totalAmount<2000) { cout"\n\nThis customer should be served with SweetBread"; } else if(totalAmount>=2000&&totalAmount<3000) { cout"\n\nThis customer should be served with Pudding"; } else if(totalAmount>=3000&&totalAmount<4000) {

cout"\n\nThis customer should be served with Cake"; } else { cout"\n\nThis customer should be served with Trifle"; } cout"\n\nDo you want to process another customer?"; char letter; cout"\n\nEnter 'Y' for Yes or 'N' to exit>:"; cin>>letter; switch(letter)

system("PAUSE"); return EXIT_SUCCESS; }

You might also like