Question: In c++, Define the class Rectangle. class must have the following private data members and functions. Implement the functions. Length( double) Width (double) A default

In c++, Define the class Rectangle. class must have the following private data members and functions. Implement the functions.

Length( double)

Width (double)

A default constructor that sets length and width to 1.

A constructor with parameter to initialize length and width.

The set and get functions for both private data members length and width.

A void print function that display the values of the length and width.

A function that returns the area of Rectangle.

Write a main function to test the Rectangle class. In the main function you must create two Rectangle objects using each of the constructors. Then call the function print on both Rectangle objects and display the area of both objects. Copy and past all code, one statement per line.

next,

Write a c++ function that receives a Rectangle object as a reference parameter. Then prompts user to enter new values for the length and width and uses the set function of the object to change the length and width to new values. Test this function, in the main function ( you have already written), call this new function, pass one of the Rectangle objects as a parameter, after the call display the new values of length and width by calling the print function in the object.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!