1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
marusya05 [52]
3 years ago
12

Extend to also calculate and output the number of 1 gallon cans needed to paint the wal. Hint: Use a math function to round up t

o the nearest gallon. (Submit for 2 points, so 5 points total)Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Cans needed: 3 can(s) Choose a color to paint the wall: Cost of purchasing blue paint: $ {'red': 35, 'blue': 75} Expected output Enter wall height (feet): Enter wall width (feet): Wall area: 1000 square feet Paint needed: 2.86 gallons Cans needed: 3 can(s) Choose a color to paint the wall: Cost of purchasing blue paint: $75

Computers and Technology
1 answer:
Crank3 years ago
5 0

Answer:

Here is the Python program:

import math #import math to use mathematical functions

height = float(input("Enter wall height (feet): ")) #prompts user to enter wall height and store it in float type variable height

width = float(input("Enter wall width (feet): ")) #prompts user to enter wall width and store it in float type variable width

area = height *width #computes wall area

print('Wall area: {} square feet'.format(round(area))) #displays wall area using round method that returns a floating-point number rounded

sqftPerGallon = 350 #sets sqftPerGallon to 350

paintNeeded = area/ sqftPerGallon #computes needed paint

print("Paint needed: {:.2f} gallons".format(paintNeeded)) #displays computed paint needed up to 2 decimal places

cansNeeded = int(math.ceil(paintNeeded)) #computes needed cans rounding the paintNeeded up to nearest integer using math.ceil

print("Cans needed: {} can(s)".format(cansNeeded)) #displays computed cans needed

colorCostDict = {'red': 35, 'blue': 25, 'green': 23} #creates a dictionary of colors with colors as key and cost as values

color = input("Choose a color to paint the wall: ") #prompts user to enter a color

if color in colorCostDict: #if the chosen color is present in the dictionary

    colorCost = colorCostDict.get(color) #then get the color cost from dictionary and stores it into colorCost using get method that returns the value(cost) of the item with the specified key(color)

    cost = cansNeeded * colorCost #computes the cost of purchasing paint of specified color per cansNeeded

  print("Cost of purchasing {} paint: ${}".format(color,colorCostDict[color])) #displays the real cost of the chosen color paint

print("Cost of purchasing {} paint per {} gallon can(s): ${}".format(color,cansNeeded, cost)) #displays the cost of chosen color paint per cans needed.

Explanation:

The program first prompts the user to enter height and width. Lets say user enter 20 as height and 50 as width so the program becomes:

Wall area computed as:

area = height *width

area = 20 * 50

area = 1000

Hence the output of this part is:

Wall area: 1000 square feet                                                                                                                     Next program computes paint needed as:

paintNeeded = area/ sqftPerGallon

Since sqftPerGallon = 350 and area= 1000

paintNeeded = 1000 / 350

paintNeeded = 2.86

Hence the output of this part is:

Paint needed: 2.86 gallons

Next program computes cans needed as:      

cansNeeded = int(math.ceil(paintNeeded))

This rounds the computed value of paintNeeded i.e. 2.86 up to nearest integer using math.ceil so,

cansNeeded = 3                                                                  

Hence the output of this part is:

Cans needed: 3 can(s)                                                                                                                            Next program prompts user to choose a color to paint the wall

Lets say user chooses 'blue'

So the program get the cost corresponding to blue color and multiplies this cost to cans needed to compute the cost of purchasing blue paint per gallon cans. So

cost = cansNeeded * colorCost

cost = 3 * 25

cost = 75

So the output of this part is:

Cost of purchasing blue paint per 3 gallon can(s): $75                                                                                        The screenshot of the program along with its output is attached.

You might be interested in
What is output if the user enters -5?
7nadin3 [17]

Answer:

The left

Explanation:

6 0
3 years ago
Read 2 more answers
Which reports indicate how traffic arrived at a website?
umka21 [38]

Answer: All traffic reports indicate how traffic arrived at a website.

Explanation:

5 0
3 years ago
Buying a house is most likely a long-term goal for a person of which of these
vekshin1

Answer:

B  i think

Explanation:

5 0
4 years ago
The fact that the impact of changes in the elements making up an IT (software) project are not proportional or intuitive is rela
Furkat [3]

Answer:

Multidimensionality

Explanation:

Multidimensionality is the ability to exhibit many diverse characteristics thereby giving programs the ability to manipulate the storage and presentation of data in various ways without disrupting the integrity and reliability of the data. It is very important that users have the capability to customize and change their views of data and user information to suit their specific needs and allow users to carry out any type of analysis within the database.

5 0
3 years ago
What is better for a samsung tab a7 a 32 gb or 64
ad-work [718]

Answer:

I think 64 GB

Explanation:

64 GB would give you more ram and more storage which means you can get more apps or take more photos on there. 32 GB is good but you have to remember that system data takes up a significant amount of storage so you shouldn't get that. I'd say 64 GB would be the best.

5 0
3 years ago
Other questions:
  • One particularly effective form of providing feedback is for the receiver to ________. restate the message in his or her own wor
    14·1 answer
  • How do i start makeing a Character in the Unreal Game Engine
    14·2 answers
  • In CadStd, what does the Zoom All button do? A. Makes a drawing bigger so you can see small details B. Returns a drawing to a si
    5·1 answer
  • 6. Larger Than n In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contain
    9·1 answer
  • Emma downloaded a new game from an unfamiliar website. A few days later, Emma realized her system had been hacked and her credit
    7·1 answer
  • What are the correct steps to find the system specifications such as the amount of RAM or system type?
    13·1 answer
  • What alternative to leased lines is used by VPNs? As an alternative to leased lines, VPNs use ______ connections.
    11·1 answer
  • A social cause is: O A. when one person protests without the support of others. B. something that not many citizens think or car
    8·1 answer
  • For risk monitoring, what are some techniques or tools you can implement in each of the seven domains of a typical IT infrastruc
    7·1 answer
  • You are investigating the use of website and URL content filtering to prevent users from visiting certain websites. Which benefi
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!