Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help. It keeps giving me errors and I dont know what I'm doing wrong. I have included my code I wrote. Also, can someone
Please help. It keeps giving me errors and I dont know what I'm doing wrong. I have included my code I wrote. Also, can someone show me how to round the paint to the nearest gallon?
Challenge: Paint Job Estimator A painting company has determined that for every 350 square feet of wall space, one gallon of paint and six hours of labor are required. The company charges $62.25 per hour for labor. Write a program called paintjobestimator.py 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 is to display the following information. The number of gallons of paint required rounded up to whole gallons. The hours of labor required. The cost of the paint based on the rounded up whole gallons. The labor charges. The total cost of the paint job. At the end of one estimate the user it to be asked if they would like to perform another estimate. Use the prompt: Would you like to do another estimate? (y) If the user answers y, then the program is to accept input for another estimate. If the user answers with anything other than y, the program is to exit. The user input should not be able to crash the program. If the user provides invalid input the program should tell the user why the input is invalid and ask again for the input. The square feet of wall space and the price of the paint per gallon must be positive values. If the user enters 0 or a negative value, the program should tell the user why the input is invalid and ask again for the input. The output is to be nicely formatted. Hours of labor is to be displayed to one decimal point (example: 12.4 hours). Gallons of paint is to be displayed as an integer value with nothing shown to the right of the decimal point (example: 5). Total labor charges is to be displayed to two decimal points and a $ is to be displayed at the start of the total labor charge value (example: $152.64). The gallons of paint is rounded up to whole gallons because the paint is colored and mixed in whole gallons. If paint is left over it can't be used on another job. You will need to find a way in Python to do the math to calculate the gallons of paint so that the result is a whole number that is a rounded up value based on the division of the square feet of space by the 350 square feet per gallon. For example, if the area to be painted is 1800 square feet, then 1800/350 is 5.142857 gallons. The rounded up whole gallons result is 6. Five gallons of paint is not enough. The need for some amount more than 5 gallons means the job requires 6 gallons even if all of it will not be used. *paintjobestimator.py - /Users/maddiliapis/Documents/Python Projects/PaintJobE... def CalculateCostOfPaint(PriceOfPaint, GallonsOfPaintRequired): CostOfPaint = GallonsOfPaintRequired * PriceOfPaint return CostOfPaint def CalculateLaborCharges (HoursOfLaborRequired): CHARGE_PER_HOUR = 62.25 LaborCharges = HoursOfLaborRequired * CHARGE_PER_HOUR return LaborCharges def CalculateTotal Cost(LaborCharges, CostOfPaint): Total Cost = LaborCharges + CostOfPaint return Total Cost eat cpainonimat chippaint?.25"2} ") def PrintBill(PaintRequired, HoursRequired, CostOfPaint, LaborCharges, Total Cost print("Paint required: " + format(PaintRequired, ".2f"), I "Hours of labor required: " + format(HoursRequired, ".2f"), I "Cost of the paint: $" + format(CostOfPaint, ",.2f"), I "Labor Charges: $" + format(LaborCharges, ", .2f"), I "Total cost: $" + format(Total Cost, ",.2f"), sep=" ") def main(): Wall Space = AskForWall Space() PriceOfPaint = AskForPriceOfPaint PaintRequired = CalculatePaintRequired(Wall Space) HoursRequired = CalculateHoursOfLabor Required(Wall Space) CostOfPaint = CalculateCostOfPaint(PriceOfPaint, PaintRequired) LaborCharges = CalculateLaborCharges (HoursRequired) Total Cost = Calculate Total Cost(LaborCharges, CostOfPaint) PrintBill(PaintRequired, HoursRequired, CostOfPaint, LaborCharges, Total Cost # getting choice from user choice = input('Would you like to do another estimate(y)?') # if the choice is yes the program will do another estimate if choice == 'Y': pass # if the choice is no or anything else then the program will terminate if choice == 'N': break main() Ln: 55 Col: 6 Challenge: Paint Job Estimator A painting company has determined that for every 350 square feet of wall space, one gallon of paint and six hours of labor are required. The company charges $62.25 per hour for labor. Write a program called paintjobestimator.py 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 is to display the following information. The number of gallons of paint required rounded up to whole gallons. The hours of labor required. The cost of the paint based on the rounded up whole gallons. The labor charges. The total cost of the paint job. At the end of one estimate the user it to be asked if they would like to perform another estimate. Use the prompt: Would you like to do another estimate? (y) If the user answers y, then the program is to accept input for another estimate. If the user answers with anything other than y, the program is to exit. The user input should not be able to crash the program. If the user provides invalid input the program should tell the user why the input is invalid and ask again for the input. The square feet of wall space and the price of the paint per gallon must be positive values. If the user enters 0 or a negative value, the program should tell the user why the input is invalid and ask again for the input. The output is to be nicely formatted. Hours of labor is to be displayed to one decimal point (example: 12.4 hours). Gallons of paint is to be displayed as an integer value with nothing shown to the right of the decimal point (example: 5). Total labor charges is to be displayed to two decimal points and a $ is to be displayed at the start of the total labor charge value (example: $152.64). The gallons of paint is rounded up to whole gallons because the paint is colored and mixed in whole gallons. If paint is left over it can't be used on another job. You will need to find a way in Python to do the math to calculate the gallons of paint so that the result is a whole number that is a rounded up value based on the division of the square feet of space by the 350 square feet per gallon. For example, if the area to be painted is 1800 square feet, then 1800/350 is 5.142857 gallons. The rounded up whole gallons result is 6. Five gallons of paint is not enough. The need for some amount more than 5 gallons means the job requires 6 gallons even if all of it will not be used. *paintjobestimator.py - /Users/maddiliapis/Documents/Python Projects/PaintJobE... def CalculateCostOfPaint(PriceOfPaint, GallonsOfPaintRequired): CostOfPaint = GallonsOfPaintRequired * PriceOfPaint return CostOfPaint def CalculateLaborCharges (HoursOfLaborRequired): CHARGE_PER_HOUR = 62.25 LaborCharges = HoursOfLaborRequired * CHARGE_PER_HOUR return LaborCharges def CalculateTotal Cost(LaborCharges, CostOfPaint): Total Cost = LaborCharges + CostOfPaint return Total Cost eat cpainonimat chippaint?.25"2} ") def PrintBill(PaintRequired, HoursRequired, CostOfPaint, LaborCharges, Total Cost print("Paint required: " + format(PaintRequired, ".2f"), I "Hours of labor required: " + format(HoursRequired, ".2f"), I "Cost of the paint: $" + format(CostOfPaint, ",.2f"), I "Labor Charges: $" + format(LaborCharges, ", .2f"), I "Total cost: $" + format(Total Cost, ",.2f"), sep=" ") def main(): Wall Space = AskForWall Space() PriceOfPaint = AskForPriceOfPaint PaintRequired = CalculatePaintRequired(Wall Space) HoursRequired = CalculateHoursOfLabor Required(Wall Space) CostOfPaint = CalculateCostOfPaint(PriceOfPaint, PaintRequired) LaborCharges = CalculateLaborCharges (HoursRequired) Total Cost = Calculate Total Cost(LaborCharges, CostOfPaint) PrintBill(PaintRequired, HoursRequired, CostOfPaint, LaborCharges, Total Cost # getting choice from user choice = input('Would you like to do another estimate(y)?') # if the choice is yes the program will do another estimate if choice == 'Y': pass # if the choice is no or anything else then the program will terminate if choice == 'N': break main() Ln: 55 Col: 6Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started