Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//Include the Rectangle.h as follows. Since it is a user defined header //we use Rectangle.h instead of #includeRectangle.h /* * This file contains the details

//Include the Rectangle.h as follows. Since it is a user defined header //we use "Rectangle.h" instead of  #include"Rectangle.h" /* * This file contains the details of the function definitions for the class Rectangle. * The prototypes of the functions are declared in Rectangle.h * When coding the function definitions, refer to the Rectangle.h and check if the functions * satisfy the prototypes. */ /* * ########## CONSTRUCTOR 1 ############# * Constructor that does not take any arguments and sets * length = 0 * width = 0 */ Rectangle::Rectangle() { length = 0; width = 0; } /* * ########## CONSTRUCTOR 2 ############## * Constructor that takes two integer arguments (int l, int w) and sets * length = l * width = w */ Rectangle::Rectangle(int l, int w) { //--> //--> } /* * Method to set the length of the Rectangle */ void Rectangle::setLength(int l) { length = l; } /* * Method to set the width of the rectangle */ void Rectangle::setWidth(int w) { //--> } /* * Method that returns the length of the Rectangle */ int Rectangle::getLength() { return length; } /* * Method that returns the width of the Rectangle */ //Define the getWidth() function similar to the getLength //--> /* * Method that calculates the Perimeter of the Rectangle and returns it * Perimeter of Rectangle is 2*(length + width) */ int Rectangle::getPerimeter() { //--> } /* * Method that calculates the area of the Rectangle and returns it * Area of Rectangle is length*width */ //Define the getArea() function similar to the getPerimeter() //--> /* * Method that checks if the Rectangle is a square and returns the result. * For a Rectangle to be a square, the length and width must be equal */ bool Rectangle::isSquare() { return length==width ? true : false; } 

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

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions