Wednesday, November 2, 2011

CS201 Assignment(1) Solution

CS201 Assignment(1) Solution

#include <iostream>
using namespace std;
main()

      int customer_nos,Grand_total;
      char choice;
      customer_nos=0;
      Grand_total=0;
          
do{
int meal,sale_tax;
cout<<"Virtual Resutrant\n";
 cout<<"\nenter the price of meal: " ;
cin>>meal;
//sale tex caluculate

 if (meal < 1000)
    {
         sale_tax=0 ;
          cout<< "Sale Tax = "<<sale_tax<<endl;

          }
else if (meal > 1000 && meal <=2000)
    {
        sale_tax= (meal/100)*1;
          cout<< "Sale Tax = " <<sale_tax<<endl;
         
          }
else
    {
        sale_tax= (meal/100)*2;
          cout<< "Sale Tax = " <<sale_tax<<endl;
         
          }

//total amount calc

int total_amount;
total_amount=meal+sale_tax;
cout<<"---------------------------------------";
cout<<"\ntotal amount is "<<total_amount<<endl;

//swet dish

if (total_amount <1000)
{
             cout<<"\nCustomer deserve Candies";   
                
                 }
else if (total_amount >=1000 && total_amount <2000)
{
             cout<<"\nCustomer deserve Sweet bread";   
                
                 }
                
else if (total_amount >=2000 && total_amount <3000)
{
             cout<<"\nCustomer deserve pudding";   
                
                 }                
                

else if (total_amount >=3000 && total_amount <4000)
{
             cout<<"\nCustomer deserve cake";   
                
                 }                            
else
{
             cout<<"\nCustomer deserve trifle";   
                
                 }                     
                
cout<< "\nDo you want to proces another coustomer ";

cin>>choice;
customer_nos++;
Grand_total=Grand_total+total_amount;
}while (choice=='Y' || choice=='y');


cout<<"\n\nNumber of Customer is "<<customer_nos;
cout<<"\nGradn Total is "<<Grand_total<<endl;

system("pause");
}

1 comment:

Contact Form

Name

Email *

Message *