Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ class named Rectangle that represents rectangle objects. A Rectangle should have two double data type member variables preferably named length and width

image text in transcribed

Write a C++ class named Rectangle that represents rectangle objects. A Rectangle should have two double data type member variables preferably named length and width Add a default constructor that assigns length and width member variables the default value of 1.0 each Add a non default constructor that takes two arguments and assigns the arguments to the member variables Add getters (getLength and getWidth) and setters (setLength and setWidth) Add a member function named getArea that does not take any argument and returns the area of the rectangle Add a member function named getPerimeter that does not take any argument and returns the perimeter of the rectangle given by 2*length + 2*width Add a member function named print that does not take any argument and prints the rectangle object appropriately (for example we may print the length, width, area, and perimeter in a nice format) Use the program given below to test your class design CMDT135

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

2. Do you find change a. invigorating? b. stressful? _______

Answered: 1 week ago