How to write this problem..

a. Show the customer the different breakfast items offered by the HIFI's restaurant.
b. Allow the customer to select more than one item from menu
c. Calculate and print the bill to the customer

Plain Egg $2.50
Bacon and Egg $3.45
Muffin $2.20
French Toast $2.95
Fruit Basket $3.45
Cereal $0.70
Coffee $1.50
Tea $1.80

Recommended Answers

All 7 Replies

What do you have so far?

i do until this

int main()
{	

	theMenu[0].menuItem  = "#1  Plain Egg";	
	theMenu[1].menuItem  = "#2  Bacon and Egg";
	theMenu[2].menuItem  = "#3  Muffin";
	theMenu[3].menuItem  = "#4  French Toast";
	theMenu[4].menuItem  = "#5  Fruit Basket";
	theMenu[5].menuItem  = "#6  Cereal";
	theMenu[6].menuItem  = "#7  Coffee";
	theMenu[7].menuItem  = "#8  Tea";

	theMenu[0].menuPrice  = 1.45;	
	theMenu[1].menuPrice  = 2.45;
	theMenu[2].menuPrice  = 0.99;
	theMenu[3].menuPrice  = 1.99;
	theMenu[4].menuPrice  = 2.49;
	theMenu[5].menuPrice  = 0.69;
	theMenu[6].menuPrice  = 0.50;
	theMenu[7].menuPrice  = 0.75;

That implies you have a lot more. You must have an array defined of some object.

What you probably want to do is build a similar collection for the order. Then create a loop where you would ask the user to select an item from the menu and add that item to the order collection. Then you have have a method that takes an order collection and outputs the list and totals the items in it.

What's the question?

try a switch function inside a loop, and g=how about posting the rest of what you have

define the data struct menu item type with two component menu item of type string and menu price of type double. Use an array to declare the data struct

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.