0% found this document useful (0 votes)
462 views

Paint Job Estimator Python 2

This program calculates the cost of a paint job by: 1) Asking the user to input the square footage of wall space and cost per gallon of paint. 2) Calculating the number of gallons needed based on 125 square feet per gallon. 3) Calculating labor costs by multiplying hours needed by $42.5 per hour. 4) Calculating paint costs by multiplying gallons needed by cost per gallon. 5) Printing the results including gallons needed, labor hours and costs, and total cost.

Uploaded by

Ceh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
462 views

Paint Job Estimator Python 2

This program calculates the cost of a paint job by: 1) Asking the user to input the square footage of wall space and cost per gallon of paint. 2) Calculating the number of gallons needed based on 125 square feet per gallon. 3) Calculating labor costs by multiplying hours needed by $42.5 per hour. 4) Calculating paint costs by multiplying gallons needed by cost per gallon. 5) Printing the results including gallons needed, labor hours and costs, and total cost.

Uploaded by

Ceh
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

print("This program calculates the cost of doing a paint job.

")
do_calculation = True
while (do_calculation):
while (True):
try:
# Input amount of square feet of wall space
square_feet = float(input("How many square feet of wall space do
you need painted? "))
if (square_feet <= 0):
print ("Zero and negative numbers can not be accepted.")
continue
except ValueError:
print("The value you entered is invalid. Only numericals are
valid.");
else:
break
while(True):
try:
# Input cost per gallon
cost_per_gallon = float(input("Cost per gallon of paint? $"))
if (cost_per_gallon <= 0):
print ('Zero and negative numbers can not be acepted.')
continue
except ValueError:
print("The value you entered is invalid. Only numericals are
valid.");
else:
break
while(True):
try:
# Input number of gallons needed
gallons_needed = float(square_feet)/125.0
except ValueError:
print("The value you entered is invalid. Only numericals are
valid.");
else:
break
# Hours of labor expected
hours_of_labor = 8 * gallons_needed
# Cost of Labor expected
labor_costs = 42.5 * hours_of_labor
# Paint cost
paint_costs = float(cost_per_gallon) * gallons_needed
# Number of gallons of paint
print("The number of gallons of paint required is %f" % gallons_needed)
# How long labor lasts
print("The number of gallons of hours of labor required are %f" %
hours_of_labor)

# Charged for labor


print("The labor charges are $%f" % labor_costs)
# Total amount of labor
print("Total labor is: %f" % (labor_costs + paint_costs))
")

another_calculation = input("\nDo you want to try another estimate? (y/n):


if (another_calculation != "y"):
do_calculation = False

You might also like