A painting company has determined that for every 115 square feet of wall space, one gal-lon of paint and eight hours of labor will be required. The company charges $20.00 per hour for labor. Write a program that asks the user to enter the square feet of wall space to be painted and the price of the paint per gallon. The program should display the following data:
The number of gallons of paint required
The hours of labor required
The cost of the paint
The labor charges
The total cost of the paint job
Python code:
#The 'calculate_paint_data' is used to calculate
#total cost of the paint job
def calculate_paint_data(square_feet, paint_price):
gallons_of_paint = square_feet / 115
hours_of_labor = square_feet / 115 * 8
cost_of_paint = gallons_of_paint * paint_price
labor_charges = hours_of_labor * 20
total_cost = cost_of_paint + labor_charges
return gallons_of_paint, hours_of_labor, cost_of_paint, labor_charges, total_cost
#main method
def main():
#Prompt and read the asks the user to enter the square
#feet of wall space to be painted and the price of
#the paint per gallon
square_feet = float(input("Enter the square feet of wall space to be painted: "))
paint_price = float(input("Enter the price of paint per gallon: "))
#Call the methods
gallons_of_paint, hours_of_labor, cost_of_paint, labor_charges, total_cost = calculate_paint_data(square_feet, paint_price)
#Display output
print("Number of gallons of paint required:", gallons_of_paint)
print("Hours of labor required:", hours_of_labor)
print("Cost of paint: $", format(cost_of_paint, ".2f"))
print("Labor charges: $", format(labor_charges, ".2f"))
print("Total cost of the paint job: $", format(total_cost, ".2f"))
if __name__ == "__main__":
main()
Executed Output:
Enter the square feet of wall space to be painted: 200
Enter the price of paint per gallon: 5000
Number of gallons of paint required: 1.7391304347826086
Hours of labor required: 13.91304347826087
Cost of paint: $ 8695.65
Labor charges: $ 278.26
Total cost of the paint job: $ 8973.91