Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (20 points) Create a new project named hw4_lastname and create a class named Rectangle that represents a rectangle. (1) Your member variables will be

image text in transcribed

image text in transcribed

1. (20 points) Create a new project named hw4_lastname and create a class named Rectangle that represents a rectangle. (1) Your member variables will be height and width. (2) Your member functions will be: setHeight(int h): mutator for height variable setWidth (int w): mutator for width variable setDimensions (int n, int w): sets both height and width getArea(): returns the area of your rectangle getPerimeter() : returns the perimeter of your rectangle print(): prints a rectangle with your dimensions composed of asterisks (3) Create a default constructor that sets the default values of Rectangle class to 1. Make sure that the mutators for height and width only take positive numbers! Test your class with the driver program given below. //--- Test driver for class Rectangle #include using namespace std; int main() { Rectangle recl, rec2; recl.setHeight (10); recl.setWidth (20); rec2.setDimensions (5, 10); cout

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

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

7. Highlight warnings and precautions.

Answered: 1 week ago

Question

How can a firm successfully undertake price discrimination

Answered: 1 week ago