Thursday, 3 November 2011

CS201 Assignment#1 Idea Solution

VUClub.net
CS201 Assignment#1 Idea Solution

#include <iostream.h> //input output stream libraray
#include <string.h> //string libraray
#include <iomanip.h> //input output manipulation library




using namespace std;

float CalculateTax(float);
int CalculateTotalBill(float,float);
void Prize(int prize);
float dev,TotalTax,Cal;
double GrandTotal=0;
int RecordCount=1;
int main()
{
cout<<right<< setw(50)<<"Virtual Restuarant"<<endl;
int Price,;

char choice;

LoopHere:
cout<<"Enter the price of the meal: "<<endl;
cin>>Price;

Prize(CalculateTotalBill(Price,CalculateTax(Price)));
cout<<"\n \nDo u want to process any other custome?"<<endl;
cout<<"enter 'Y' to continue or 'N'to cancel"<<endl;
cin>>choice;
if((choice=='y') || (choice=='Y'))
{
++RecordCount;
goto LoopHere;
}
else if((choice=='n') || (choice=='N'))
{
cout<<"Total Entries were found: "<<RecordCount<<endl;
cout<<"grand total is: "<<GrandTotal<<endl;
system("pause");
}
else
{
cout<<"insaan da bacha ban k input dou"<<endl;
}

return 0;
}

float CalculateTax(float P)
{
if((P>1000) && (P<=2000))
{
dev= 1.0;
TotalTax= (dev/ 100)*P;
return TotalTax;
}
else if(P>2000)
{
dev= 2.0;
TotalTax= (dev/ 100)*P;
return TotalTax;
}
else
{
TotalTax=0.0;
return TotalTax;
}
}

int CalculateTotalBill(float Amount,float TaxPayable)
{
cout<<"Price of the meal: "<<"\t"<<Amount<<endl;
cout<<"Payable tax is: "<<"\t"<<TaxPayable<<endl;
cout<<"---------------------------------"<<endl;
cout<<"Total amount:"<<"\t\t"<<Amount+TaxPayable<<endl;
GrandTotal+=Amount+TaxPayable;
return Amount+TaxPayable;
}
void Prize(int prize)
{
if(prize<1000)
{
cout<<"this GAAHAK should be served with candies"<<endl;

}
else if ((prize>=1000) && (prize<2000))
{
cout<<"this GAAHAK should be served with Sweet Bread"<<endl;

}
else if ((prize>=2000) && (prize<3000))
{
cout<<"this GAAHAK should be served with Pudding"<<endl;

}
else if ((prize>=3000) && (prize<4000))
{
cout<<"this GAAHAK should be served with Cake"<<endl;

}
else
{
cout<<"this GAAHAK should be served with Trifile"<<endl;

}
}

0 comments:

Post a Comment

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More