You are on page 1of 4

#include<iostream>

using namespace std;


#include<string>
void welcome (string);
void rangebased(int);
int main ()
{
string mystring,flavour;
int serialnumber,price,order,total,useramount,range;
char answer,ans,y,Y;
mystring="WELCOME TO THE CLASSIC CAKESHOP";
welcome(mystring);
cout<<"do you want to enter your own range ?";
cin>>answer;
if ((answer=='y')||(answer=='Y'))
{
cout<<"enter your range";
cin>>range;
rangebased(range);
}
else
do{
string choice [5]={"choclate","cheese","mousee","fruit","coffee"};
cout<<"SELECT THE TYPE OF CAKE YOU REALLY WANT TO HAVE :"<<"\n";
for (int i=0;i<5;i++)
{
cout<<i<<"="<<choice[i]<<endl;
}

cout<<"press the serial number given with the flavours to select the cake";
cin>>serialnumber;
cout<<"the flavour you selected is number ="<<serialnumber<<endl;
switch (serialnumber)
{

case 0:

case 1:

cout<<"the cake u selected is"<<choice[0]<<endl;


price=1000;
cout<<"the price of this cake is Rs"<<price<<endl;
break;
cout<<"the cake u selected is" <<choice[1]<<endl;
price=1200;
cout<<"the price of the cake is Rs"<<price<<endl;
break;

case 2:

case 3:

cout<<"the cake u selected is"<<choice[2]<<endl;


price=1500;
cout<<"the price of the cake is Rs "<<price<<endl;
break;
cout<<"the cake u selected is"<<choice[3]<<endl;
price=1000;
cout<<"the price of the cake is Rs "<<price<<endl;
break;

case 4:

cout<<"the cake u selected is"<<choice[4]<<endl;

price =2000;
cout<<"the price of the cake is Rs "<<price<<endl;
break;
default:
cout<<"the selection is invalid"<<endl;
}
cout<<"do you want to cancel your order to select again ?"<<endl;
cout<<"enter y for yes and n for continuing with the same selection:"<<endl;
cin>>answer;
}while((answer=='y')||(answer=='Y'));
cout<<"how many cakes u want to order ?"<<endl;
cin>>order;
total=price*order;
cout<<"your bill is of rupess ="<<total<<endl;
cout<<"please pay the bill of amount ="<<total<<endl;
cin>>useramount;
if (useramount>=total)
{
cout<<"*************************classic
cakeshop**************************"<<endl;
cout<<"\t""\t""\t""*******""BILL RECIPTE" "********""\t""\t""\t"<<endl;
cout<<order<<"cake number "<<serialnumber<<"\t"<<"="<<total<<endl;
cout<<"amount paid ="<<useramount<<endl;
cout<<"change given ="<<(useramount-total)<<endl;
cout<<"THANK YOU FOR VISITING "<<endl;
}
if (useramount<total)
{
cout<<"the amount you enterd is inappropriate"<<endl;
cout<<"enter more amount ="<<total-useramount<<"to get the order"<<endl;
}
system("pause");
return 0;
}
void welcome (string string1)
{
cout<<"\t"<<"\t"<<"*****************************************************"<<endl;
cout<<"\t"<<"\t"<<"*****************************************************"<<endl;
cout<<"\t"<<"\t"<<"\t"<<string1<<endl;
cout<<"\t"<<"\t"<<"******************************************************"<<endl;
cout<<"\t"<<"\t"<<"******************************************************"<<endl;
}
void rangebased(int x)
{
{int selection,price,order,useramount,total;
char ans,y,Y;
if (x>=500&&x<1000)
{
cout<<"you can buy a fruit cake "<<"for seletion press 0";
cin>>selection;
}
if (x>=1000&&x<1500)
{
cout<<"you can buy a fruit cake or a choclate cake or a cheese cake";
cout<<"press 0 for fruit cake and 1 for choclate cake and 2 for cheese cake selection";
cin>>selection;
}
if (x>=1500&&x<2000)

cout<<"you can buy a fruit cake ,choclate cake or a cheese cake or a mousee

cake ";

cout<<"press 0 for fruit cake and 1 for choclate cake and 2 for cheese cake and 3 for
mousee selection";
cin>>selection;
}
if (x>=2000&&x<2500)
{
cout<<"you can buy a fruit cake ,choclate cake or a cheese cake or a mousee
cake or a cofee cake";
cout<<"press 0 for fruit cake and 1 for choclate cake and 2 for cheese cake and 3 for
mousee and 4 for cofeee selection";
cin>>selection;
}
do{
switch (selection)
{
case 0:
cout<<"the cake u selected is fruite cake ";
price=500;
cout<<"the price of the cake is "<<price;
break;
case 1:
cout<<"the cake u selected is choclate";
price =1000;
cout<<"the price of the cake u selected is "<<price;
break;
case 2:
cout<<"the cake u selected is cheese";
price =1500;
cout<<"the price of the cake u selected is "<<price;
break;
case 3:
cout<<"the cake u selected is mousee";
price =2000;
cout<<"the price of the cake u selected is "<<price;
break;
case 4:
cout<<"the cake u selected is cofee";
price =2500;
cout<<"the price of the cake u selected is "<<price;
break;
default:
cout<<"the entry is invalid please do the selection again from the given menu";
}
cout<<"do u want to do the selection again ";
cin>>ans;
}while ((ans=='y')||(ans=='Y'));
cout<<"how many cakes u want to order ?"<<endl;
cin>>order;
total=price*order;
cout<<"your bill is of rupess ="<<total<<endl;
cout<<"please pay the bill of amount ="<<total<<endl;
cin>>useramount;
if (useramount>=total)
{

cout<<"*************************classic
cakeshop**************************"<<endl;
cout<<"\t""\t""\t""*******""BILL RECIPTE" "********""\t""\t""\t"<<endl;
cout<<"\t"<<"="<<total<<endl;
cout<<"amount paid ="<<useramount<<endl;
cout<<"change given ="<<(useramount-total)<<endl;
cout<<"THANK YOU FOR VISITING "<<endl;
}
if (useramount<total)
{
cout<<"the amount you enterd is inappropriate"<<endl;
cout<<"enter more amount ="<<total-useramount<<"to get the order"<<endl;
}
}
}

You might also like