Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(1) Implement the IsItSquare function. IsItSquare takes parameters height and width as doubles and returns a boolean. If the given height and width make a

(1) Implement the IsItSquare function. IsItSquare takes parameters height and width as doubles and returns a boolean. If the given height and width make a square, return true.

(2) Implement the PrintIsItSquare function. PrintIsItSquare takes parameters height and width as doubles and calls IsItSquare. PrintIsItSquare then outputs the results of IsItSquare. The numbers should be printed with exactly one digit after the decimal point. Ex:

A rectangle with height 4.5 and width 6.3 is not a square. A rectangle with height 5.2 and width 5.2 is a square. 

(3) Implement the MakeSquare function. MakeSquare takes parameters height and width as doubles and modifies them to make them equal if they are not already. This function should shrink the longer side to match to shorter side. You need to declare your function such that the caller of your function can see the changes to the parameters (By default, functions make copies of the variables you pass in before using them. Normally, changing values in your function will change the values of those copies instead of the variables you originally passed in).

(4) Implement the CalcPerimeter function. CalcPerimeter takes parameters height and width as doubles and calculates and returns the perimeter of the rectangle.

(5) Implement the PrintPerimeter function. PrintPerimeter takes parameters height and width as doubles and calls CalcPerimeter. PrintPerimeter then outputs the results. The numbers should be printed with exactly one digit after the decimal point. Ex:

A rectangle with height 4.5 and width 6.3 has a perimeter of 21.6. 

(6) Implement the DoublePerimeter function. DoublePerimeter takes parameters height and width as doubles and modifies them such that the perimeter of the rectangle they make is double but maintains the same ratio of height to width. You need to declare your function such that the caller of your function can see the changes to the parameters (By default, functions make copies of the variables you pass in before using them. Normally, changing values in your function will change the values of those copies instead of the variables you originally passed in).

Additional note: you can assume that all values passed to your functions will be greater than 0.

c++

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions