Dynamically allocate an array of menuitems

Assignment Help C/C++ Programming
Reference no: EM13763529

You will write a menu and ordering system for a restaurant using a class for the menu items. Put the class code and the main in a single file.

Write a class menuItem that contains the following:

A member variable to contain an integer that is an item number

A member variable to contain a string describing the item, for example "Cheese Omelette"

A member variable to contain the price of the item

A default constructor that sets the item number to 0, the description to "unknown" and the price to 0

A constructor that accepts the item number, description and price as arguments.

Accessor (get) functions for each of the member variables

Mutator (set) functions for each of the member variables

A function called printItem that prints out the information for a menu item in a nice format on a single line.

Write your main to:

Prompt the user to enter the number of items on the menu. Validation: The input should be greater than 0 and not more than 50

Dynamically allocate an array of menuItems based on the number of items input.

Dynamically allocate a parallel array of integers that will store the quantity of that item in a customer order.

Prompt the user to enter the description and price for each menu item. You can assign the item number using the order the items were entered (starting at 1, not 0). You'll need to use cin.get() and getline when mixing string and numeric input (see pages 120-125 in the textbook). Validation: Do not allow prices <= 0.

Display the menu. Make up a name for the restaurant that includes your last name.

Loop asking the user to enter a sales ticket number or 0 to exit. If 0 is entered, the program should output the grand total of sales for the run and end. Remember to delete the dynamic arrays before the return 0.

If a ticket number is entered, loop asking the user to enter the item numbers ordered on that ticket, entering 0 when finished. It is your choice if you want to ask for a quantity or just have the user enter the same item number multiple times. Each time the user selects an item, increment the count of that item chosen in the parallel integer array. When the user enters 0, display the list of the items they ordered with the count of each (with or without the menu item number or cost). Then display the total amount due for that order.

Validation: A check number should not be less than 0.

I've attached a sample run. Please feel free to improve on my user interface. Also feel free to break your main up into functions. I created functions to print out the menu and to get each menu item input from the user.

When your code is working properly, copy and paste the code to the answer box. Also attach a screen capture showing the program running.

Reference no: EM13763529

Questions Cloud

You will develop an in-depth look at a career : You will develop an in-depth look at a career or college major, concentrating on what is needed to achieve this career, the nature of the work, and the impact that can be made from this work.
What is the accounting equation : What is the accounting equation? Suppose your company sold $12,000 in merchandise to a customer for cash. How does this transaction impact the accounting equation?
Explain the management dilemma or the business problem : Develop a research question and a hypothesis for a hypothetical business problem of your choice. Explain the management dilemma or the business problem that the research would attempt to solve
Effect on the break-even point in units : Which of the following will have no effect on the break-even point in units?
Dynamically allocate an array of menuitems : Dynamically allocate an array of menuItems based on the number of items input. Dynamically allocate a parallel array of integers that will store the quantity of that item in a customer order.
Discuss the major nontariff barriers to trade : Define tariff and the different types of tariffs and identify and discuss the major nontariff barriers to trade.
Required supplementary information : Question 1: Which of the following items are considered Required Supplementary Information (RSI)?
Hat are risks associated with being independent contractor : What are the risks associated with being an independent contractor? Use the Library or other Web resources to support your answer
Describe a specific tariff and an ad valorem tariff : Describe a specific tariff, an ad valorem tariff, and compound tariff. What are the advantages and disadvantages of each?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Draw a two-dimensional house seen from the front

Draw a two-dimensional house seen from the front, the way a child would: with a door, two windows, and a roof with a chimney. Feel free to add details; mabe have "smoke" come out of the chimney.

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Find the amount in the savings act each month

Suppose you start with $1000 and each month you contribute $100. suppose that the interest rate is 6%per year compounding monthy,which is equal to 0.5% each month.

  calculates the average rainfall

Write a program that calculates the average rainfall for three months. The program should ask the user to enter the name of each month, such as June or July, and the amount of rain (in millimeters) that fell each month.

  Q1 write a program that generates the following

q1. write a program that generates the following outputnbspnbspnbspnbspnbspnbspnbspnbsp 10nbspnbspnbspnbspnbspnbspnbsp

  Write a program that accepts as input a string variable

Write a program that accepts as input a string variable called strFirstName, then another string variable called strLastName, and an integer variable called intAge.

  The stack-based routing scheme

the stack-based routing scheme you are to have a stack of maze locations.

  Write a program that allows users to enter a dollar amount

Write a program that allows users to enter a dollar amount for their bank account balance at the beginning of the month.

  Write a function integerpower

Write a function integerPower(base, exponent) that returns the value of base^exponent. For example, integerPower(3, 4) = 3* 3 * 3* 3. Do not use any math library functions.

  Write a switch-case programming for calculation

How to use C++ to write a switch-case programming for calculation? Test the program for a wide range of possible inputs including division by zero and square root of negative values.

  Display the complete fibonacci sequence

Display the complete Fibonacci sequence until u reach a value less than or equal one million - display the count of how many numbers are in that sequence between 1 and 1000000

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd