Question: 2 . 2 4 Lab Exercise Ch 2 b: Painting a wall, with string ( 1 ) Your code is to be written and tested

2.24 Lab Exercise Ch 2b: Painting a wall, with string
(1) Your code is to be written and tested in Visual C++, and Source.cpp should be uploaded to ZyLab to verify with its tests. If your .cpp file is NOT named source, do a "save as" source.cpp before uploading.
Prompt the user to input a paint color, and save that in a string variable. Also prompt the user for the wall's height and width. Calculate and output the wall's area. (1 pt)
Note: This zyLab outputs a newline after each user-input prompt. For convenience in the examples below, the user's input value is shown on the next line, but such values don't actually appear as output when the program runs.
```
Enter paint color:
green
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
```
(2) Extend to also calculate and output the color and the amount of paint in gallons needed to cover the wall. Assume a gallon of paint covers 350 square feet. Store this assumed coverage in a const double variable. (1 pt )
```
Enter paint color:
green
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Needed: 0.514286 gallons of green paint
```
(3) Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function from the cmath library to round up to the nearest gallon. (1 pt)
```
Enter paint color:
red
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Needed: 0.514286 gallons of red paint
Cans needed: 1 can(s)
```
2 . 2 4 Lab Exercise Ch 2 b: Painting a wall,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!