Question: Write a C + + program that defines a class Rectangle with the following specifications: Private members for storing the length and width of a
Write a C program that defines a class Rectangle with the following specifications:
Private members for storing the length and width of a rectangle.
A public constructor that initializes the length and width to values provided by the user.
A public member function area that calculates and returns the area of the rectangle.
A public member function perimeter that calculates and returns the perimeter of the rectangle.
A public member function isSquare that returns true if the rectangle is a square ie length and width are equal and false otherwise.
Write a main function to create an object of Rectangle, take user input for the length and width, and then display the area, perimeter, and whether the rectangle is a square.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
