In [ ]:
# run this code to login to https://okpy.org/ and setup the assignment for submission
from ist256 import okclient
ok = okclient.Homework()

Now You Code 2: House Depot Paint Estimator

The big-box hardware store House Depot has contracted you to write an App to estimate the amount of paint required to paint a room. Given that 1 gallon of paint covers 400 square feet, you must output the number of paint cans required to paint a rectangular room.

The program should input:

  • the length of the room in feet,
  • the width of the room in feet,
  • the height of the room in feet

The program should output:

  • total area to be painted (sum of each of the 4 walls, multiplied by the height of the room)
  • the number of gallons of paint required to paint the room.

Example:

Enter length of room: 12
Enter width of room: 14
Enter height of room: 8
Total area to be painted: 416.00
Total gallons of paint requried: 2

HINT: Use the math.ceil() function to round up your number of gallons to the nearest whole number. You cannot sell fractional cans of paint!

Step 1: Problem Analysis

Inputs:

Outputs:

Algorithm (Steps in Program):


In [1]:
import math # you need this to use math.ceil(), so we wrote this part of the code for you!!! LEAVE IT HERE!
# Step 2: write code here

Step 3: Questions

  1. Why does the program still run when you enter a negative number for length?

Answer:

  1. Does the output make sense when you enter a negative length? Why type of error is this?

Answer:

  1. Why do we use math.ceil() in this program? In other words are you allowed to buy 3.75 gallons of paint?

Answer:

Step 4: Reflection

Reflect upon your experience completing this assignment. This should be a personal narrative, in your own voice, and cite specifics relevant to the activity as to help the grader understand how you arrived at the code you submitted. Things to consider touching upon: Elaborate on the process itself. Did your original problem analysis work as designed? How many iterations did you go through before you arrived at the solution? Where did you struggle along the way and how did you overcome it? What did you learn from completing the assignment? What do you need to work on to get better? What was most valuable and least valuable about this exercise? Do you have any suggestions for improvements?

To make a good reflection, you should journal your thoughts, questions and comments while you complete the exercise.

Keep your response to between 100 and 250 words.

--== Write Your Reflection Below Here ==--


In [ ]:
# to save and turn in your work, execute this cell. Your latest submission will be graded. 
ok.submit()