Question: 1 9 . 3 LAB * : Program: Painting a wall LABACTIVITY 1 9 . 3 . 1 : LAB * : Program: Painting a
LAB: Program: Painting a wall
LABACTIVITY
: LAB: Program: Painting a wall
Program Specifications Write a program to calculate the cost to paint a wall. Amount of required paint is based on the wall area. Total cost includes paint and sales tax.
Note: This program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress.
Step pts Read from input wall height, wall width, and cost of one paint can floats Calculate and output the wall's area to one decimal place using printfWall area: wallarea:f sq ft; Submit for grading to confirm test passes.
Ex: If the input is:
the output is:
Wall area: sq ft
Step pts Calculate and output the amount of paint needed to three decimal places. One gallon of paint covers square feet. Submit for grading to confirm tests pass.
Ex: If the input is:
the output is:
Wall area: sq ft Paint needed: gallons
Step pts Calculate and output the number of gallon cans needed to paint the wall. Extra paint may be left over. Hint: Use ceil from the math module to round up to the nearest gallon int Submit for grading to confirm tests pass.
Ex: If the input is:
the output is:
Wall area: sq ft Paint needed: gallons Cans needed: cans
Step pts Calculate and output the paint cost, sales tax of and total cost. Dollar values are output with two decimal places. Submit for grading to confirm all tests pass.
Ex: If the input is:
the output is:
Wall area: sq ft Paint needed: gallons Cans needed: cans Paint cost: $ Sales tax: $ Total cost: $
Here is my code:
import math
# Step
wallheight, wallwidth, paintcancost mapfloat inputsplit
wallarea wallheight wallwidth
printfWall area: wallarea:f sq ft
# Step
paintneeded wallarea
printfPaint needed: paintneeded:f gallons"
# Step
cansneeded math.ceilpaintneeded
printfCans needed: cansneeded cans
# Step
paintcost paintcancost cansneeded
salestax paintcost
totalcost paintcost salestax
printfPaint cost: $paintcost:f Sales tax: $salestax:f Total cost: $totalcost:f
Here is my error:
Traceback most recent call last:
File usercodeagpyrunnerpy line in
execopenfilenameread
File line in
NameError: name 'totalcost is not defined
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
