Wednesday, October 26, 2011

Assignment Solution CS201 1 Fall 2011 Virtual Restaurant

copy the code in Div c++ and run it.
Please makes changes before submit it.




#include<iostream.h>


main()
{
      int price, total=0, tax, cus=0, gtotal=0;
      char chr;
      cout<<"*** Virtual Restaurant ***\n";
   
      do
      {
           cus++;
           cout<<"\nplease Enter the Price of Meal: ";
           cin>>price;
         
           if(price<=1000)
           {
                          tax=0;
           }
           else if(price >1000 && price < 2000)
           {
                         tax = price * 1/100;
           }
           else if (price >2000 )
           {
                          tax = price * 2/100;
           }
         
           cout<<"\n\nPrice of meal: "<<price<<endl;
           cout<<"Sales Tax:     "<<tax<<endl;
           cout<<"-------------------------"<<endl;
           total = price + tax;
           gtotal+=total;
           cout<<"Total Amount:  "<<total<<endl;
         
           if(total < 1000)
           {
                    cout<<"\nThis customer should be served with candies"<<endl;
           }
           else if(total >= 1000 && total < 2000)
           {
                    cout<<"\nThis customer should be served with Sweet Bread"<<endl;
           }
           else if(total >= 2000 && total < 3000)
           {
                    cout<<"\nThis customer should be served with Pudding"<<endl;
           }
           else if(total >= 3000 && total < 4000)
           {
                    cout<<"\nThis customer should be served with Cake"<<endl;
           }
           else
           {
                    cout<<"\nThis customer should be served with Trifle"<<endl;
           }
         
           cout<<"\nDo You Want to Process another Customer?  ";
           cin>>chr;
         
         
      }
      while(chr == 'y' || chr == 'Y');
   
      cout<<"\n\n\nGrand Total:"<<endl;
      cout<<"\nTotal Customers:            "<<cus<<endl;
      cout<<"Total Amount of all bills:  "<<gtotal<<"\n\n"<<endl;
   
      system("pause");
}

No comments:

Post a Comment