help me using python? You are working for an interior design company and they ne
ID: 3691529 • Letter: H
Question
help me using python?
You are working for an interior design company and they need you to design software for them. Specifically, for a rectangular room they need a program to determine and display:
Total area on the walls and ceiling (for paint)
Total area on the floor for flooring
Total room volume for fans and lighting
Total length along the perimeter for trim (the total amount includes both the floor and ceiling)
Total cost for paint and total cost for flooring.
The program will prompt the user for the length, width and height of the room. In addition, it should prompt for the cost of one gallon of paint and one square foot of flooring. Then the program calculates and displays the dimensions listed above, the amount of paint needed (as number of gallon paint cans) to paint the walls and ceiling, the amount of flooring, and the separate costs for paint and flooring.
Some things to note:
When calculating the area for paint, subtract 10% from the total wall area to account for windows.
One gallon of paint coverages 350 square feet (on average).
The program should only recommend whole numbers of paint cans (for example, not 3.2 paint cans, but 4). Similarly, no decimal values for the amount of flooring needed. Round up to the next whole number.
All the units are in feet (or square feet or cubic feet)
User Interface Specifications
Input
At the start, the program should display a brief description of what it does. This is different than a comment (for a different audience)
The program then prompts for the three measurements of the room, making sure that the units of input are clear to the user
After the measurements, the program prompts for the unit prices for paint and flooring.
Output
Once done with calculations, the program should display a report to the user with the following:
The user input
The final results and costs
total area of walls and ceiling (minus windows)
volume
trim requirements
amount of paint needed and the cost
amount of flooring needed and the cost
Make sure to display units for all numbers as appropriate
Code Specifications
include header comments at the top of the file that has your name, date, and a brief description of the program. The description should be 1 to 2 lines long describing the purpose of the program.
include comments for each section: input, process, output. An example might be: # get room dimensions from user
include blank lines to separate the main sections of the code
use descriptive variable names.
Explanation / Answer
import math
# Input section - gets room dimensions, as well as paint and flooring prices from
# the user.
print()
length = float(input("Please enter a length in feet. "))
width = float(input("Please enter a width in feet. "))
height = float(input("Please enter a height in feet. "))
paintPrice = float(input("Please enter the price of a gallon of paint. $"))
floorPrice = float(input("Please enter the price of one square foot of flooring. $"))
# Processing section - This section does all of the calculations.
volume = length*width*height
perimeter = 4*(length+width)
floor = math.ceil(length*width)
ceiling = length*width
floorCost = floor*floorPrice
roomSize = ceiling+1.0*(width*height+length*height)#This comes from subtracting
# windows and floor from the surface area formula.
paintGallons = math.ceil(roomSize/350)
paintCost = paintGallons*paintPrice
# Output section - This section tell the user all of their own inputs, and
# displays the dimensions, and costs.
print()
print()
print("The length of the room is:",length,"ft.")
print("The width of the room is:",width,"ft.")
print("The height of the room is:",height,"ft.")
print("The total room volume is:",format(volume, '.1f'),"cu. ft.")
print("The total amount of trim needed is:",perimeter,"ft")
print("The amount flooring needed is:",floor,"sq. ft.")
print("The cost of flooring will be: $",format(floorCost, '.2f'))
print("The surface area of the room, with windows is:",roomSize,"sq. ft.")
print("The room will require",paintGallons,"gallons of paint.")
print("The cost of paint will be: $",format(paintCost, '.2f'))
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.