I am suppose to write a c++ program that show
1. shows the different breakfadt items offered
2. allow the customer to make more than one selection
3.allow the user to select multiple orders of a particular type
4. calculate and display the bill

This is what i've got so far. I am confused on the code on making the selection

//Automates a resturants billing system
#include <iostream>
#include <conio.h>
using namespace std;
enum menuListType{Egg, Bacon and Egg, Muffin, Toast, Fruit, Cereal, Coffee, Tea};
struct menuItemType
{
 string menuItem;
 double menuPrice;
 menuListType item; 
};
void getData(menuItemType&);
void getMenu();
void displayCheck(menuItemType);
int main()
{
 cout << fixed << showpoint;
 
 getData(menuList);
 getMenu();
 displayCheck(menuList);
 return 0;
}
void getData(menuItemType)
{
 cout << "Enter breakfast item;" << endl;
 cin >> item;
 return0;
}
void showMenu()
{
 cout << "Welcome to Johnny's Resturant" << endl;
 cout << " Items Served" << endl;
 cout << "Plain Egg" << "" << $1.45" << endl;
 cout << "Bacon and Egg" << "" << $2.45" << endl;
 cout << "Muffin" << "" << $0.99" << endl;
 cout << "French Toast" << "" << $1.99" << endl;
 cout << "Fruit Basket" << "" << $2.49" << endl;
 cout << "Cereal" << "" << $0.69" << endl;
 cout << "Coffee" << "" << $0.50" << endl;
 cout << "Tea" << "" << $0.75" << endl;
}
void displayCheck(menuItemType)

I am suppose to write a c++ program that show
1. shows the different breakfadt items offered
2. allow the customer to make more than one selection
3.allow the user to select multiple orders of a particular type
4. calculate and display the bill

This is what i've got so far. I am confused on the code on making the selection

//Automates a resturants billing system
#include <iostream>
#include <conio.h>
using namespace std;
enum menuListType{Egg, Bacon and Egg, Muffin, Toast, Fruit, Cereal, Coffee, Tea};
struct menuItemType
{
 string menuItem;
 double menuPrice;
 menuListType item; 
};
void getData(menuItemType&);
void getMenu();
void displayCheck(menuItemType);
int main()
{
 cout << fixed << showpoint;
 
 getData(menuList);
 getMenu();
 displayCheck(menuList);
 return 0;
}
void getData(menuItemType)
{
 cout << "Enter breakfast item;" << endl;
 cin >> item;
 return0;
}
void showMenu()
{
 cout << "Welcome to Johnny's Resturant" << endl;
 cout << " Items Served" << endl;
 cout << "Plain Egg" << "" << $1.45" << endl;
 cout << "Bacon and Egg" << "" << $2.45" << endl;
 cout << "Muffin" << "" << $0.99" << endl;
 cout << "French Toast" << "" << $1.99" << endl;
 cout << "Fruit Basket" << "" << $2.49" << endl;
 cout << "Cereal" << "" << $0.69" << endl;
 cout << "Coffee" << "" << $0.50" << endl;
 cout << "Tea" << "" << $0.75" << endl;
}
void displayCheck(menuItemType)

Get a switch loop working with a do..while. According to the choice increment the no of items of a particular type...finally sum up all and display..

Also can ask while taking order the no of items..
Hope this helps!!

I would probably have another class called Selection that contains a menuListType to represent the selection and an int to represent the number of that menuListType selected. I would store each Selection in a container of Selections declared in main and send it by reference to getData() and displayCheck().

You need to decide whether you want the function to be getMenu or showMenu. To you they may be the same, to the computer they are not.

Then within the body of the getMenu or showMenu identify each item on the menu with a number.

cout << "Welcome to Johnny's Resturant" << endl;
cout << " Items Served" << endl;
cout << "1) Plain Egg" << "" << $1.45" << endl;
cout << "2) Bacon and Egg" << "" << $2.45" << endl;

In getData() declare a variable of type Selection called selection. Have the user select an menu item by number and store that value in the menuListType member of selection. Then have user indicate how many items of that type they want and store that in selection as well. Then add selection to the container of Selections and repeat until user indicates they are done.

In the displayCheck() function use the container of Selection to create your check. You can use a switch to display the menuItemType corresponding to the menuListType of the given Selection. You can display the number of items for that Selection, the cost of each item and total cost for that selection. You can keep a running total representing the cost of all Selections displayed so far. Whatever.

This article has been dead for over six months. Start a new discussion instead.