Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Recommended due date, Saturday 5/21. Add to the program (11-10) from pages 753-755 as follows: 1. To Length class files (Length.h and Length.cpp) add the

Recommended due date, Saturday 5/21.

Add to the program (11-10) from pages 753-755 as follows:

1. To Length class files (Length.h and Length.cpp) add the operator overload for stream insertion (>) from page 759. You should not use the modified version of class Length from page 759 because it contains more operator overloads. Instead of typing you can use copy/paste from Length1.h and Length1.cpp respectively.

2. In main() replace the lines 11-16 with appropriate usage of stream extraction overload (>>) to change "first" and "second" objects with values inputted by the end user.

3. In main(), replace the output on lines 21,22 and 25,26 with appropriate usage of stream insertion (

The resulting output should be identical with the unmodified version of the program.

Save and submit your files as Length.h, Length.cpp, and pr11-10_Lab.cpp.

image text in transcribedimage text in transcribed
11.6 Operator Overloading 741 Program 1 1-1 0 (continued) 32 cout 4 #include "Length.h" using namespace std; 7 int main( ) 8 { 9 Length first(0) , second(0), third(0); 10 int f, i; 11 cout > f >> i; 13 first . setLength (f, i) ; 14 cout > f >> i; 16 second . setLength (f, i) ; 17 18 / / Test the + and - operators 19 third = first + second; 20 cout

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 Programming questions