106k views
0 votes
In this assignment you are to develop a function (name the function calc_amt_paint) that will accept the width of a room, the length of a room, the height of a room, the number of doors and the number of windows. Given that information and the information below, the function is to return the number of gallons of paint (a whole number) needed to paint the room.

◦ A gallon of paint will cover 400 square feet
◦ A door has an area of 20 square feet
◦ A window has an area of 15 square feet
Using the function developed above. Calculate (and print to the screen) the total number of gallons needed to paint a house with the following room dimensions.
house = [ [14, 14, 8, 2, 3], [12, 12, 8, 2, 3], [12, 12, 8, 2, 3], [12, 12, 8, 2, 3], [14, 14, 8, 2, 3], [8, 6, 8, 1, 1], [8, 6, 8, 1, 1], [10, 12, 8, 1, 2], [6, 2, 8, 1, 0], [10, 12, 8, 1, 2], [6, 2, 8, 1, 0], [8, 6, 8, 1, 1], ]

1 Answer

7 votes

Final answer:

To calculate the amount of paint needed to paint a room, calculate the total area to be painted, subtract the areas of doors and windows, and divide by the coverage of one gallon of paint. For example, a room with dimensions 14x12x8 feet, 2 doors, and 3 windows would require 2 gallons of paint.

Step-by-step explanation:

To calculate the amount of paint needed to paint a room, we need to calculate the total area to be painted and subtract the areas of the doors and windows. The formula for the total area is:

Total Area = (2 * length * height) + (2 * width * height)

Each door has an area of 20 square feet, so we need to subtract (20 * number of doors) from the total area. Similarly, each window has an area of 15 square feet, so we need to subtract (15 * number of windows) from the total area. Finally, divide the adjusted total area by 400 square feet (the coverage of one gallon of paint) to get the number of gallons needed.

For example, let's calculate the amount of paint needed for a room with a length of 14 feet, width of 12 feet, height of 8 feet, 2 doors, and 3 windows.

Total Area = (2 * 14 * 8) + (2 * 12 * 8) = 448 + 384 = 832 square feet

Adjusted Total Area = 832 - (20 * 2) - (15 * 3) = 832 - 40 - 45 = 747 square feet

Number of Gallons Needed = 747 / 400 = 1.8675. Since we need a whole number of gallons, we round up to 2 gallons.

User Artem Kolontay
by
8.3k points