Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include // Include the Rectangle.h file #include Rectangle.h using namespace std; int main() { //Create Rectangle object r1 using Constructor that does not take any

#include

// Include the Rectangle.h file #include "Rectangle.h"

using namespace std;

int main() { //Create Rectangle object r1 using Constructor that does not take any arguments. //NOTE how the object is created without passing any values. Rectangle r1;

//Now Create Rectangle object r2 using Constructor that takes two integer arguments (2,2). //You need to use CONSTRUCTOR 2 defined in Rectangle.cpp and it takes two arguments Rectangle r2(2,2);

//Lets print the details of Rectangles r1 and r2 //Notice how we use the get functions to get the length and width of the rectangle cout<<"Rectangle r1 details: r1[length="<

//Lets print the Perimeter of Rectangle r1 cout<<"Rectangle r1 Perimeter = "<

//Lets print the area of Rectangle r1 cout<<"Rectangle r1 Area = "<

// Define 2 integer variables length and width and take them as input from user. //--> cout << "Please enter the length of the first rectangle: "; //--> cout << "Please enter the width of the first rectangle: "; //-->

//lets change the length and width of rectangle r1 from [0,0] to [length,width] // Change the length of r1 to r1.setLength(length); //Change the width of r1 to r1.setWidth(Width);

//Lets the print the new details of Rectangle r1 cout<<"Rectangle r1 details: r1[length="<//Calculate the new Perimeter of r1 and print it //--> //Calculate the new area of r1 and print it //-->

//Lets use the isSquare() function to check if the Rectangles r1 and r2 are squares if(r1.isSquare()) cout<<"Rectangle r1 is a square "; else cout<<"Rectangle r1 is NOT a square ";

//Check if Rectangle r2 is a square and print if it so (similar to above) if(r2.isSquare()) cout<<"Rectangle r2 is a square "; else cout<<"Rectangle r2 is NOT a square ";

return 0; }

Please complete the bolded parts.

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

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

Good Evening, Problem Designed for excel or financial calculator

Answered: 1 week ago

Question

1 What demand is and what affects it.

Answered: 1 week ago