Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Your output Cans needed: 3 can (s) Choose a color to paint the wall: Cost of purchasing blue paint: $25

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

In Python. How do I get the cost of blue to $75? I keep getting $25.

Output differs. See highlights below.
20
Input
50
blue
Enter wall height (feet):
Enter wall width (feet):
Wall
area: 1000 square feet
Paint needed: 2.86 gallons
Your output
Cans needed: 3 can(s)
Choose a color to paint the wall:
Cost of purchasing blue paint: $25
Enter wall height (feet):
Enter wall width (feet):
Wall
area: 1000 square feet
Paint needed: 2.86 gallons
Expected output
Cans needed: 3 can(s)
Choose a color to paint the wall:
Cost of purchasing blue paint: $75
Transcribed Image Text:Output differs. See highlights below. 20 Input 50 blue Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Your output Cans needed: 3 can(s) Choose a color to paint the wall: Cost of purchasing blue paint: $25 Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Expected output Cans needed: 3 can(s) Choose a color to paint the wall: Cost of purchasing blue paint: $75
1 import math
2
3
4
5 # FIXME (1): Prompt user to input wall's width
6 wall_height = int(input('Enter wall height (feet):\n'))
7 wall_width = float(input ('Enter wall width (feet):\n'))
%3D
8
9 # Calculate and output wall area
10 area = wall_width * wall_height
11
12
13 print ('Wall area:', int(area), "square feet")
14
15
16 # FIXME (2): Calculate and output the amount of paint in gallons needed to paint the wall
17 paint = area/350
18 print('Paint needed: {:.2f} gallons' .format(paint))
19
20
21 # FIXME (3): Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer
22 print ('Cans needed:', math.ceil(paint),'can(s) ')
23
24 paint_colors = {
'red': 35,
'blue': 25,
'green': 23
}
25
26
27
28
29 # FIXME (4): Calculate and output the total cost of paint can needed depending on color
30 color = input('\nChoose a color to paint the wall:\n')
31 print('Cost of purchasing', color, 'paint: $'+str (paint_colors[color]))
32
33
34
Transcribed Image Text:1 import math 2 3 4 5 # FIXME (1): Prompt user to input wall's width 6 wall_height = int(input('Enter wall height (feet):\n')) 7 wall_width = float(input ('Enter wall width (feet):\n')) %3D 8 9 # Calculate and output wall area 10 area = wall_width * wall_height 11 12 13 print ('Wall area:', int(area), "square feet") 14 15 16 # FIXME (2): Calculate and output the amount of paint in gallons needed to paint the wall 17 paint = area/350 18 print('Paint needed: {:.2f} gallons' .format(paint)) 19 20 21 # FIXME (3): Calculate and output the number of 1 gallon cans needed to paint the wall, rounded up to nearest integer 22 print ('Cans needed:', math.ceil(paint),'can(s) ') 23 24 paint_colors = { 'red': 35, 'blue': 25, 'green': 23 } 25 26 27 28 29 # FIXME (4): Calculate and output the total cost of paint can needed depending on color 30 color = input('\nChoose a color to paint the wall:\n') 31 print('Cost of purchasing', color, 'paint: $'+str (paint_colors[color])) 32 33 34
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education