BAKERY ORDERING SYSTEM

guys this is my project and i need your guidance based on c++ because i don't have basics in c++...i have no idea how to continue program this codes...anyone can help me?

#include <iostream> // library that contains basic input output functions
#include <cmath>
using namespace std;

int main()
{

int option; // user's entered option will be saved in this variable
do //do-while loop starts here.that display menu again and again until user select to exit program
{
//Displaying Options for the menu
cout << "1) cakes " << endl;
cout << "2) Pastry " << endl;
cout << "3) Drinks" << endl;
cout << "4) Exit Program " << endl;
//Prompting user to enter an option according to menu
cout << "Please choose your favourite items : ";
cin >> option; // taking option value as input and saving in variable "option"

if(option == 1) // Checking if user selected option 1
{
//Display cakes

cout<<"*******DAISY BAKERY SHOP***************" << endl;

cout << "A.CHOCOLATE CAKES RM 35.00 (PERKG)" << endl;
cout << "B.BANANA CAKES RM 20.00 (PERKG)" << endl;
cout << "C.BUTTER CAKES RM 25.00 (PERKG)" << endl;
cout << "D.VANILLA CAKES RM 30.00 (PERKG)" << endl;
cout << "E.CARROT CAKES RM 35.00 (PERKG)" << endl;
cout << "F.CHEESE CAKES RM 40.00 (PERKG)" << endl;
cout << "G.OREO CHEESE CAKES RM 55.00 (PERKG)" << endl;
cout << "H.BLUEBERRY CHEESE CAKES RM 60.00 (PERKG)" << endl;
cout << "J.TIRAMISU CAKES RM 80.00 (PERKG)" << endl;
cout << "K.LEMON CAKES RM 55.00 (PERKG)" << endl;
cout << "L.MARBLE CAKES RM 25.00 (PERKG)" << endl;
cout << "M.MOLTEN CHOCOLATE CAKES RM 100.00 (PERKG)" << endl;
cout << "N.RED VELVET CAKES RM 120.00 (PERKG)" << endl;
cout << "O.STRAWBERRY CAKES RM 35.00 (PERKG)" << endl;
cin>>option;
}
else if(option == 2) // Checking if user selected option 2
{
//Displaying pastry
cout<<"*******DAISY BAKERY SHOP***************" << endl;
cout << "1.DONUT RM5.00" << endl;
cout << "2.CREAM PUFF RM2.50" << endl;
cout << "3.APPLE PIE RM2.00" << endl;
cout << "4.CROISSANT RM3.00" << endl;
cout << "5.CURRY PUFF RM3.50" << endl;

}
else if(option == 3) // Checking if user selected option 3
{
//displaying drinks
cout<<"*******DAISY BAKERY SHOP***************" << endl;
cout<< " HOT COLD"<< endl;
cout << "1.COFFEE RM 6.00 RM 6.90 " << endl;
cout << "2.BLACK COFFEE RM 5.00 RM 5.50 " << endl;
cout << "3.WHITE COFFEE RM 6.90 RM 7.00 " << endl;
cout << "4.CAPPUCINO RM 6.50 RM 6.90 " << endl;
cout << "5.EXPRESSO RM 4.50 RM 5.50 " << endl;
cout << "6.MOCHA RM 5.50 RM 5.90 " << endl;
cout << "7.TEA RM 6.00 RM 6.50 " << endl;
cout << "8.GREEN TEA RM 5.90 RM 6.90 " << endl;

}
else if(option == 4) // Checking if user selected option 4
{
cout << "Terminating Program" << endl;
}
else //if user has entered invalid choice (other than 1,2,3 or 4)
{
//Displaying error message
cout << "Invalid Option entered" << endl;
}
}
while(option != 4); //condition of do-while loop

return 0;

}

I would want to use separate variables to keep track of the user's selection from the main menu, which drives the while loop, and the selections from individual product menus.

1
2
3
4
5
6
7
8
9
10
11
12
if(option == 1) // Checking if user selected option 1
{
//Display cakes

cout<<"*******DAISY BAKERY SHOP***************" << endl;

cout << "A.CHOCOLATE CAKES RM 35.00 (PERKG)" << endl;
cout << "B.BANANA CAKES RM 20.00 (PERKG)" << endl;
cout << "C.BUTTER CAKES RM 25.00 (PERKG)" << endl;
...
cin>>option;
}


I think I would also try to be consistent in using either a number or an alpha character for the product menus. Right now the cakes use letters while the pastries and coffees use numbers.

What else does the code need to do?
the user need to select the cakes and quantity ....and i need a code to calculate it
You can make it so that after the user has input the option (1,2,3,4), it would then ask the user to select the cake, and the quantity.
yes..
So after user cin>>option you may ask the user something like cout << "What would you like to buy?" << endl;. Get the user input and calculate the total.

If you need anymore help, pm me for a faster response.
Last edited on
im sorry i had change the coding but still i have problem to calculate the total...please guide me

#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<cctype>


using namespace std;

int main()

{
char choice='Y';

int order = 1;

int num1=0,num2=0,num3=0,num4=0,num5=0,num6=0,num7=0,num8=0,num9=0,num10=0;
int num_customers;
int sentinel=0;
const double unitprice1= 20.00,unitprice2= 25.00,unitprice3= 30.00,unitprice4= 35.00,unitprice5=35.00,unitprice6= 40.00,unitprice7=55.00,unitprice8=60.00,unitprice9= 100.00,unitprice10= 120.00;
float AmountofSale1= 0, AmountofSale2=0, AmountofSale3=0,AmountofSale4=0,AmountofSale5=0,AmountofSale6=0,AmountofSale7=0,AmountofSale8=0,AmountofSale9=0,AmountofSales9=0,AmountofSales10=0;
string name,addr;
int phone_num;
float addition;



{

cout<<"\t\t********************************"<<endl;
cout<<"\t\t WELCOME TO DAISY BAKERY SHOP"<<endl;
cout<<"\t\t********************************\n"<<endl;
}

{
cout<<"PLEASE ENTER YOUR NAME:"<<endl;
cin>>name;
cout<<"\tWELCOME TO DAISY BAKERY SHOP:"<<name<<endl;
cout<<"*******************************"<<endl;
cout<<"PLEASE ENTER YOUR PHONE NUMBER"<<endl;
cin>>phone_num;
cout<<"THANK YOU FOR YOUR INFORMATION"<<endl;

}



cout<<"*******THE WORLD OF SWEETS***************\n\n" << endl;

cout << "1. BANANA CAKES RM 20.00 (PERKG)\n" << endl;
cout << "2. BUTTER CAKES RM 25.00 (PERKG)\n" << endl;
cout << "3. VANILLA CAKES RM 30.00 (PERKG)\n" << endl;
cout << "4. CHOCOLATE CAKES RM 35.00 (PERKG)\n" << endl;
cout << "5. STRAWBERRY CAKES RM 35.00 (PERKG)\n" << endl;
cout << "6. CHEESE CAKES RM 40.00 (PERKG)\n" << endl;
cout << "7. OREO CHEESE CAKES RM 55.00 (PERKG)\n" << endl;
cout << "8. BLUEBERRY CHEESE CAKES RM 60.00 (PERKG)\n" << endl;
cout << "9. MOLTEN CHOCOLATE CAKES RM 100.00 (PERKG)\n" << endl;
cout << "10.RED VELVET CAKES RM 120.00 (PERKG)\n" << endl;


while (order != sentinel)
{
cout<< "please order the favourite items\n";
cin>>order;
switch (order)
{

case 0:

break;

case 1:

cout<<"how many banana cakes would you like to have\n";
cin>>num1;

AmountofSale1= unitprice1 * num1;
break;

case 2:

cout<<"how many buttercakes would you like to have\n";
cin>>num2;

AmountofSale2= unitprice2 * num2;
break;

case 3:

cout<<"how many vanillacakes would you like to have\n";
cin>>num3;

AmountofSale3= unitprice3 * num3;
break;

case 4:

cout<<"how many chocolatecakes would you like to have\n";
cin>>num4;

AmountofSale4= unitprice4 * num4;
break;

case 5:

cout<<"how many strawberrycake would you like to have\n";
cin>>num5;

AmountofSale5= unitprice5 * num5;
break;

case 6:

cout<<"how many cheesecake would you like to have\n";
cin>>num6;

AmountofSale6= unitprice6 * num6;
break;

case 7:

cout<<"how many oreo cheese cake would you like to have\n";
cin>>num7;

AmountofSale7= unitprice7 * num7;
break;

case 8:
cout<<"how many blueberry cheese cake would you like to have\n";
cin>>num8;

AmountofSale8= unitprice8 * num8;
break;

case 9:
cout<< "how many molten chocolate cake would you like to have\n";
cin>>num9;

AmountofSale9= unitprice9 * num9;
break;

case 10:
cout<< "how many red velvet cake would you like to have\n";
cin>>num10;

AmountofSales10= unitprice10 * num10;
break;



default: cout<<"Please choose a valid item from our list\n";
}
{


cout<<"You have ordered:\n\n";

cout<<left<<setw(15)<<"ITEM"<<right<<setw(15)<<"QUANTITY\t"<<right<<setw(15)<<"\t UNIT PRICE"<<right<<setw(20)<<"\t AMOUNT OF SALE\t\t\n";


cout<<"banana cake:\t\t" <<setw(6)<<left<<num1 <<setw(15)<<right<< unitprice1 <<setw(20) <<right<< AmountofSale1<<endl;

cout<<"butter cake:\t\t" <<setw(6)<<left<<num2 <<setw(15)<<right<< unitprice2 <<setw(20) <<right<< AmountofSale2<<endl<<endl;

cout<<"vanilla cake:\t\t" <<setw(6)<<left<<num3 <<setw(15)<<right<< unitprice3 <<setw(20) <<right<< AmountofSale3<<endl<<endl;

cout<<"chocolate cake:\t\t" <<setw(6)<<left<<num4 <<setw(15)<<right<< unitprice4 <<setw(20) <<right<< AmountofSale4<<endl<<endl;

cout<<"strawberry cake:\t" <<setw(6)<<left<<num5 <<setw(15)<<right<< unitprice5 <<setw(20) <<right<< AmountofSale5<<endl<<endl;

cout<<"cheese cake:\t\t" <<setw(6)<<left<<num6 <<setw(15)<<right<< unitprice6 <<setw(20) <<right<< AmountofSale6<<endl<<endl;

cout<<"oreo cheese cake:\t" <<setw(6)<<left<<num7 <<setw(15)<<right<< unitprice7 <<setw(20) <<right<< AmountofSale7<<endl<<endl;

cout<<"blueberry cheese cake:\t"<<setw(6)<<left<<num8 <<setw(15)<<right<< unitprice8 <<setw(20) <<right<< AmountofSale8<<endl<<endl;

cout<<"molten chocolate cake:\t"<<setw(6)<<left<<num9 <<setw(15)<<right<< unitprice9 <<setw(20) <<right<< AmountofSale9<<endl<<endl;

cout<<"redvelvet cake:\t\t" <<setw(6)<<left<<num10 <<setw(15)<<right<< unitprice10 <<setw(20) <<right<< AmountofSales10<<endl<<endl;
}
{
float AmountofSale1,AmountofSale2,AmountofSale3,AmountofSale4,AmountofSale5,AmountofSale6,AmountofSale7,AmountofSale8,AmountofSale9,AmountofSale10,z;
z=AmountofSale1+AmountofSale2+AmountofSale3+AmountofSale4+AmountofSale5+AmountofSale6+AmountofSale7+AmountofSale8+AmountofSale9+AmountofSale10;
cout<<"please total up the item";
cin>>z;
cout<< "the total price is:"<<z<<endl;
return z;

}
}
system("PAUSE");
return 0;
}
It would be good practice to use [code]Your code here[./code](without the period) so it's not just a long line of text. Your code right now asks the user to calculate the total cost, is that intended, or is your program suppose to do that? If your program is suppose to calculate the total, then you should have a float sum and increase sum after every purchase.
Last edited on
Topic archived. No new replies allowed.