All pastes #2093375 Raw Edit

Anonymous

public text v1 · immutable
#2093375 ·published 2011-11-09 15:28 UTC
rendered paste body
//This program will calculate the total price of meat of a resturant and will determine that with 
//which gift the customer should be serverd
#include<iostream>
using namespace std;

int main(){
    //declaring variables
    int count=1;
    float price,salestax,total,grandtotal=0;
    char selection;
    
    //starting do-while loop that will restart the program if needed
    //and will count the customers
    do{
          cout<<"+++++Virtual Resturant+++++";
          cout<<"Please enter the price of the meal: ";   //prompt the user to enter the price of meal
          cin>>price;
          
          //using if statement to determine the amount of sales tax
          if(price<=1000){
                              salestax=0;
                              }
          else if(price>1000&&price<=2000){
               salestax=(1/100)*price;
               }
          else{
               salestax=(2/100)*price;
               }
          //Calculate the total price and display it on the screen
          total=price+salestax;
          cout<<"Price of the Meal: "<<price<<endl;
          cout<<"Sales tax: "<<salestax<<endl;
          cout<<"-----------------------------"<<endl;
          cout<<"Total Amount: "<<total<<endl;
          
          //now the if structure will determine the gift
          if(total<1000){
               cout<<"The customer should be sereved with candies."<<endl;
               }
          else if(total>=1000&&total<2000){
               cout<<"The customer should be served with the Sweet Bread."<<endl;
               }
          else if(total>=2000&&total<3000){
               cout<<"the customer should be served with the Pudding."<<endl;
               }
          else if(total>=3000&&total<4000){
               cout<<"The customer should be served with the Cake."<<endl;
          else if(total>=4000){ 
               cout<<"The customer should be served with the Triffle."<<endl;
               }
          cout<<"Do you want to process another customer?"<<endl;
          cout<<"enter 'Y' for yes or 'N' to exit: "<<endl;
          cin>>selection;
          
          count=count+1;
          grandtotal=grandtotal+total;
          }
          while(selection=='Y'||selection=='y')
          
          //now if statement will dtermine the total customers and grandtotal
          if(selection=='N'||selection=='n'){
                                             cout<<"Grand Totals: "<<endl;
                                             cout<<"Total customers: "<<count<<endl;
                                             cout<<"Total amount for all bills: "<<grandtotal<<endl;
                                             }
           
               
system("PAUSE");
return 0;
}