Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Functions to Implement (This is all in c++ and I was wondering if i can get help with this) (1) Implement the IsItSquare function. IsItSquare

Functions to Implement (This is all in c++ and I was wondering if i can get help with this)

(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.

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

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

More Books

Students also viewed these Databases questions

Question

Differentiate the function. r(z) = 2-8 - 21/2 r'(z) =

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

d. How will lack of trust be handled?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago