Problem

In this exercise, you modify the Rectangle class from Lab 15-2 so that its setDimensions...

In this exercise, you modify the Rectangle class from Lab 15-2 so that its setDimensions method returns a value. You also modify the Terney Landscaping program.

a. If necessary, create a new project named Intermediate15 Project and save it in the Cpp7\Chap15 folder. Copy the instructions from the Lab15-2.cpp file into a source file named Intermediate15.cpp. Change the filename in the first comment.

b. 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 Intermediate15 Rectangle.h file. Change the filename in the first comment.

c. Modify the setDimensions method so that it returns a value that indicates whether the length and width dimensions passed to the method are valid. To be valid, each dimension must be greater than 0.0. If the setDimensions method indicates that the length and width dimensions are valid, the program should calculate and display both the area and the total price; otherwise, it should display an error message. Modify the program appropriately.

d. Save and then run the program. Test the program using 120 feet as the length, 75 feet as the width, and 1.55 as the price. The program should display 1000.00 as the area in square yards and $1550.00 as the total price. Now, run the program again. Enter –5 as the length, 6 as the width, and 3 as the price. The program should display an error message because the length dimension is less than 0.0.

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