ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 8.00

Dictionary of paint colors and cost per gallon

I have an error just in the last line, can yo help me?

import math

# Dictionary of paint colors and cost per gallon
paintColors = {
'red': 35,
'blue': 25,
'green': 23
}

# FIXME (1): Prompt user to input wall's width
# Calculate and output wall area

wallHeight = float(input('Enter wall height (feet):n'))
wallwidth = float(input('Enter wall width (feet):n'))
wallArea = int(wallHeight * wallwidth)
print('Wall area:', wallArea, 'square feet') 
# FIXME (2): Calculate and output the amount of paint in gallons needed to paint the wall
paintNeeded = wallArea / 350
print('Paint needed: %f' % paintNeeded, 'gallons')
cansNeeded = math.ceil(paintNeeded)
print('Cans needed:', cansNeeded,'can(s)n')
# FIXME (3): Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer

# FIXME (4): Calculate and output the total cost of paint can needed depending on color
paintColor = input()
print('Choose a color to paint the wall:')
paintCost = {'red':35, 'blue':75}
print('Cost of purchasing', paintColor, 'paint: $', paintCost)

 

 

3.12 Ch 3 Program: Painting a wall (Python 3) (1) Prompt the user to input a wall's height and width. Calculate and output the wall's area (integer). (Submit for 2 points).
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
(2) Extend to also calculate and output the amount of paint in gallons needed to paint the wall (floating point). Assume a gallon of paint covers 350 square feet. Store this value in a variable. Output the amount of paint needed using the %f conversion specifier. (Submit for 2 points, so 4 points total). Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.514286 gallons
(3) Extend to also calculate and output the number of 1 gallon cans needed to paint the wall. Hint: Use a math function to round up to the nearest gallon. (Submit for 2 points, so 6 points total). Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.514286 gallons
Cans needed: 1 can(s)
(4) Extend by prompting the user for a color they want to paint the walls. Calculate and output the total cost of the paint cans depending on which color is chosen. Hint: Use a dictionary to associate each paint color with its respective cost. Red paint costs $35 per gallon can, blue paint costs $25 per gallon can, and green paint costs $23 per gallon can. (Submit for 2 points, so 8 points total).
Enter wall height (feet):
12
Enter wall width (feet):
15
Wall area: 180 square feet
Paint needed: 0.514286 gallons
Cans needed: 1 can(s)
Choose a color to paint the wall:
red
Cost of purchasing red paint:
$35

Attachments:

Answers

(11)
Status NEW Posted 02 May 2017 03:05 AM My Price 8.00

-----------

Attachments

file 1493694160-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)