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
A "want" is very different than a "need'. What is a want?
Snowcat [4.5K]
I miss read the question the first time....the answer is C.
8 0
4 years ago
Read 2 more answers
What is a mask used for? What is a format used for? Which can affect the way that data is stored?
scoray [572]

Answer:

 Mask is the process of replacing and changing the sensitive information and data element from the stored data so, the given structure in the data remain the same while the data itself change for protecting the sensitive information or data in the system.

This process is commonly known as data masking. The main purpose of mask is that it protecting the information or data.  

Format is the process of specify the bits for using in the digital storage and it is mainly used for encoding the information and data. It basically designed for formatting the document so that it can store in the media with the proper format in the computer system.

3 0
4 years ago
after installing a secondary hard drive what needs to be done to the hard drive and what do these two task do?
gladu [14]
Keep the first hard drive then override it insert the second one and memory goes into the second one
8 0
3 years ago
How can having good organization skills help you be a better students/employee?
abruzzese [7]

Answer:

Help you be a better student:

1. its easier to find things to help you study

2. it's easier to turn assignments in

help you be a better employee

1. organization skills can help you get a job

2. they can help you while your working the job

3. they can help others who are working the same job\ are trying to buy something from your job (some kind of store example: grocery store, clothing store, furniture store etc.)

8 0
3 years ago
_____ is human thinking and problem-solving by a machine, including learning, reasoning, and self-correction.
Delvig [45]
Yea, artificial intelligence :/
4 0
3 years ago
Other questions:
  • Mike wants to build an amplifier. which technology can he use?
    6·1 answer
  • Where will the CPU store data for easy access and quick retrieval during these computations?
    13·1 answer
  • A Windows user has been successfully saving documents to the file server all morning. However, the latest attempt resulted in th
    9·2 answers
  • If you were to create a new app for a smartphone or tablet that does not already exist, what would you create?
    10·1 answer
  • What are the similarities between data mining and data analytics
    11·1 answer
  • You are using a PowerPoint template from your school to present your research findings in front of the class. What would you do,
    13·2 answers
  • Which daemon manages the physical memory by moving process from physical memory to swap space when more physical memory is neede
    14·1 answer
  • .input devices are pieces of equipment that are used to put data into the computer true or false​
    13·1 answer
  • !!!!!HELP!!!!! (30PTS)
    6·1 answer
  • What is a presentation program? Name any<br> presentation programs.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!