CS201 Assignment 1 Solution Fall 2011
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)