Problem

In this exercise, you modify the Rectangle class from Lab 15-2 so that it includes an ov...

In this exercise, you modify the Rectangle class from Lab 15-2 so that it includes an overloaded method.

a. If necessary, create a new project named Advanced19 Project and save it in the Cpp7\Chap15 folder. Copy the instructions from the Lab15-2 Rectangle.h file (which is located in either the Cpp7\Chap15\Lab15-2 Project folder or the Cpp7\Chap15 folder) into a header file named Advanced19 Rectangle.h. Change the filename in the first comment.

b. Pool-Time, a company that sells in-ground pools, wants a program that its salespeople can use to determine the number of gallons of water required to fill an in-ground pool. To calculate the number of gallons, you need to find the volume of the pool. The volume formula is length * width * depth. Modify the Rectangle class so that it can be used to represent a pool. You will need to include an additional private variable to store the depth value, as well as an additional public method to calculate and return the volume. You also will need to modify the default constructor and also overload the setDimensions method. Be sure to verify that the depth value is greater than 0.0 before assigning the value to the private variable.

c. Use the IPO chart shown in Figure 15-27 to code the program. Enter your C++ instructions in a source file named Advanced19.cpp. Also enter appropriate comments and any additional instructions required by the compiler. Display the volume and number of gallons with two decimal places.

d. Save and then run the program. Use 25 feet as the length, 15 feet as the width, and 6.5 feet as the depth. The program should display 2437.50 as the volume and 18233.84 as the number of gallons of water.

REFERENCE:

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 15