Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step 1: Producing correct output Three commented-out lines of code exist in main(). Uncomment the lines and click the Run program button. Verify that the

Step 1: Producing correct output

Three commented-out lines of code exist in main(). Uncomment the lines and click the "Run program" button. Verify that the program's output is:

2 + 2 = 4

Unknown function: PrintPlus2

Secret string: "abc"

Submit your code for grading. Your submission will pass the "Compare output" test only, achieving 1 of the possible 10 points.

Step 2: Inspecting the LabPrinter class3

Inspect the LabPrinter class implemented in the LabPrinter.h file. Access LabPrinter.h by clicking on the orange arrow next to main.cpp at the top of the coding window. Member functions Print2Plus2() and PrintSecret() print strings using std::cout.

Step 3: Implementing CallFunctionNamed()

Remove the three uncommented lines from main(). Then implement the CallFunctionNamed() function in main.cpp to handle three cases:

  • If functionName is "Print2Plus2", call printer's Print2Plus2() member function.
  • If functionName is "PrintSecret", call printer's PrintSecret() member function.
  • If functionName is anything other than the two strings mentioned above, print "Unknown function: xyz", where xyz is functionName's value.

After implementing CallFunctionNamed(), click the "Run program" button. Verify that the program's output is, once again:

2 + 2 = 4

Unknown function: PrintPlus2

Secret string: "abc"

Step 4: Submitting code for 10/10 points

Once CallFunctionNamed() is properly implemented, submitting the code should receive 10 out of 10 points. The program's output is exactly the same as the implementation from step 1. But step 3's implementation uses the LabPrinter object and step 1 does not.

Step 5: Understanding the difference

The unit test uses a different implementation of LabPrinter than what's shown in LabPrinter.h. Calls to each member function are tracked, so the unit test determines whether or not CallFunctionNamed() was actually implemented according to lab requirements.

Most labs in this material are similar. Program output matters, but how the output is achieved matters more. Functions you implement will commonly require use of an object passed as a parameter.

That is the instructions but i have no idea of what to do and it is due this sunday

it is a data structures lab

image text in transcribed
image text in transcribed

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

Recommended Textbook for

Linked Data A Geographic Perspective

Authors: Glen Hart, Catherine Dolbear

1st Edition

1000218910, 9781000218916

More Books

Students also viewed these Databases questions

Question

Identify ways to increase your selfesteem.

Answered: 1 week ago