#include<iostream>
#include <stdlib.h>
#include<fstream>
#include<string>
using namespace std;
void Shape()
{
int numshape;
cout<<"\t\t\tShape for the cake !!! ";
cout<<"\n\n\t\tCylinder Cone Cube ";
cout<<"\n\t\t 1 2 3 ";
cout<<"\n\n\t\t\t Pyramid Cuboid ";
cout<<"\n\t 4 5";
cout<<"\n\nEnter the shape for the cake.\n ";
cin>>numshape;
switch(numshape)
{
case 1 :
cout<<"You have choose Cylinder";
break;
case 2 :
cout<<"You have choose Cone ";
break;
case 3 :
cout<<"You have choose Cube ";
break;
case 4 :
cout<<"You have choose Pyramid ";
break;
case 5 :
cout<<"You have choose Cuboid ";
break;
default : cout<<"It's in valid";
}
}
void typeName()
{
int numtype ,price, price1 = 35,price2 =45 ,price3 = 55,newprice, question,question2,kg,kg2,Totalkg;
double d;
cout<<"\t\t\t Type of Cake ";
cout<<"\nButter Cake\t\tChocolate cake\t\tCheese cake\n";
cout<<" 1\t\t\t\t2\t\t 3\n ";
cout<<"****************************************************\n\n";
cout<<"Please enter the type for the cake";
cin>>numtype;
switch(numtype)
{
case 1 :
cout<<"You have choosen butter cake \n";
cout<<"The price is RM"<<price1<<" per kg\n";
cout<<"Do you want to add more KG to your cake ?\n";
cout<<"Enter 11 for Yes and 12 for No\n ";
cin>>question;
switch(question)
{
case 11: cout<<"\nHow many KG do you want ?\n";
cin>>kg;
//process
Totalkg=1+kg;
d=price1*kg;
cout<<"\nYour cake now is "<<Totalkg<<"kg\n";
cout<<"The price is now\n"<<d;
break;
default:cout<<"\n error wrong input";
break;
case 2 :
cout<<"You have choosen Chocolate Cake\n ";
cout<<"The price is"<<price2<<"per kg\n";
cout<<"Do you want to add more KG to your cake ?\n";
cout<<"Enter 1 for Yes and 2 for No \n";
cin>>question;
//cleear kan nanti
if(question=1)
{
cout<<"\nHow many KG do you want ?\n";
cin>>kg;
Totalkg=1+kg;
d=price2*kg;
cout<<"\nYour cake now is "<<Totalkg<<"kg\n";
cout<<"The price is now "<<d;
}
else
cout<<"error wrong input\n";
break;
case 3 :
cout<<"You have choosen Cheese Cake \n";
cout<<"The price is"<<price3<<"per kg\n";
cout<<"Do you want to add more KG to your cake ?\n";
cout<<"Enter 1 for Yes and 2 for No \n";
cin>>question;
//cleear kan nanti
if(question=1)
{
cout<<"\nHow many KG do you want ?\n";
cin>>kg;
Totalkg=1+kg;
d=price3*kg;
cout<<"Your cake now is "<<Totalkg<<"kg\n";
cout<<"The price is now \n"<<d;
}
void Topping()
{
int numTopping ,totalamount, newprice;
double d;
cout<<"\tThe best topping in the world\n\n";
cout<<" Fresh Fruits\t\tToasted Coconut\n\n";
cout<<"\t1\t\t\t2 \n ";
cout<<" \n ";
cout<<"Toasted Nuts\t\tMini Chocolate Cake\n";
cout<<"\t3\t\t\t4 \n\n";
cout<<"Pick your favourite Topping number";
cin>>numTopping;
switch(numTopping)
{
case 1 :
cout<<"Fresh fruits will charge you RM5";
totalamount=5+d;
break;
case 2 :
cout<<"Toasted Coconut will charge you RM2";
totalamount=2+d;
break;
case 3 :
cout<<"Toasted Nuts will charge you RM6";
totalamount=6+d;
break;
case 4 :
cout<<"Mini Chocolate Cake will charge you RM4";
totalamount=4+d;
break;
}system("cls");
}
int main()
{
double newtotalamount,totalamount,numshape,numtype,numTopping;
ofstream myfile("Resit.txt");
if(myfile.is_open())
{
Shape();
system("cls");
typeName();
Topping();
newtotalamount=totalamount+(totalamount*0.7);
myfile<<"\t\tANY CAKE SHOP\n";
myfile<<"----------------------------------\n";
myfile<<"Type of Shape"<<numshape<<"\n";
myfile<<"Type of Cake "<<numtype<<"\n";
myfile<<"Type of Topping"<<numTopping<<"\n";
myfile<<"The Total price of your cake is"<<newtotalamount<<"\n"<<endl;
myfile<<"Thanks for purchasing \n";