Question: Question: Write a C + + program that creates a class Rectangle with two private data members length and width. The class should have: A
Question:
Write a C program that creates a class Rectangle with two private data members length and width. The class should have:
A constructor to initialize the length and width.
A member function area that returns the area of the rectangle.
A member function perimeter that returns the perimeter of the rectangle.
A function compareAreaRectangle &other that compares the area of the current rectangle with another rectangle and returns:
if the current rectangle's area is larger,
if the current rectangle's area is smaller,
if both areas are equal.
Write a main function to demonstrate the use of this class by creating two Rectangle objects, comparing their areas, and displaying the result.
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
