Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INCLUDE SCREENSHOT OF OUTPUT C++ Submission of Your Work You need to prepare and submit ONE SINGLE MS Word document to Canvas (in your lab

INCLUDE SCREENSHOT OF OUTPUT
C++
image text in transcribed
image text in transcribed
Submission of Your Work You need to prepare and submit ONE SINGLE MS Word document to Canvas (in your lab section) as LastName_FirstName_Labxy.doc. It must contain: - Your NAME is the only item on page 1 - For each question: - Specify the question number, if more than one question. - Source code. Copy/Paste your final source code. You must include standard "comment header" even if code is provided. Do Not paste a snippet of your source code, it must be copy/pasted. - Initial test plan. After reading the requirements, but before beginning any coding, create the test case table, below, completed through column Expected Output. Include in your report. - Final test plan. Write your program then complete the test table with actual output results and include in your report AFTER your source code. - Output results. Paste in a snippet of output showing results for every listed test case in your final test plan, labeled with test case \# Test Table: Add / delete rows from Test Table as necessary Modify column widths as necessary Test both valid and invalid input Test for every output expected If failure is an expected output and it happens then that test Passes Any test that fails means the program must be fixed so that it passes the test Failing tests need a new test row, ie 1a,1b, etc, showing corrections from original Unless you don't have time to finish your testing, there should never be a Fail in final test plan Use separate source files and header files to create a class to represent menu items in the cafeteria. a. A menu object has attributes of: name (string), calories (integer), and price (double). b. Member functions (methods) for the object are as follows (no additional ones may be created): i. Using a constructor initializer list, create a constructor with default parameter values for a "Hamburger", 375 calories, with a price of 4.75. Have the constructor display +h itConstructor called for item ? price: Sprice ( 2 decimal places)>, Calories: . nn" replacing xxxx > with attribute values. ii. Individual const get methods (in-line method definition) for each attribute iii. A single const get method (NOT in-line) that uses pass-by-reference for the 3 attributes and has retum-type void iv. One set method (NOT in-line) that sets the 3 attributes v. printMe method (NOT in-line) that returns string containing: Menu Item: Selling Price: Calories: major> replacing xxxx with the appropriate attribute values vi. Destructor (in-line method definition) that displays "inlDestructor called for item: > major: n ", replacing with the appropriate attribute value Write a complete program that uses the menu class you created and tests its functionality: a. Declare a single menu object and during declaration initialize it to have item name "BetterBurger"; do not provide a value for number of credit hours b. Call the printMe method of the object created and display to the screen/console c. Create and empty data file "Lab2Menultems.dat" . d. Declare a vector of 10 objects of object class vii. Ask the user to input the information for 4 food items. All information can be entered on the same line and no food item should have a space. i.e. Enter item, calories, and price: Pita 1201.85 viii. The price and calories must be non-negative. If either is negative, print a message and discard the entire line. ix. Create and empty a data file "Lab2Menultems,dat" and write to it using the value retumed by PrintMe for every item in your vector c. Explicitly close the output file f. Perform any other tests you deem appropriate to prove your program fulfills the requirements In order to properly capture the destructor messages, put a breakpoint on the retum statement in main. When the program pauses at that line, press F 10 once, capture the output screen as a snippet, then press FS to finish execution

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions