Question

In: Computer Science

Write a program in PYTHON that determines the cost of painting the walls of a windowless...

Write a program in PYTHON that determines the cost of painting the walls of a windowless room. There is one door and it will be painted the same color as the walls. The problem requires a main function and two custom functions that are imported from a custom module that you create. In main, the program should prompt the user for five inputs shown in blue in the Sample Output below:

the length, width, and height of the room in feet.


the cost of one quart of the chosen paint.


the square feet that can be covered by one quart of paint.


The three dimensions of the room should then be used as arguments for a function that calculates and returns the area of the walls in square feet. This area and the remaining two inputs should be used as arguments for a second, void function that determines and prints the cost of the painting job. There will likely be paint left over. There is a method in the math module that you can use to "round up" the number of quarts needed.
Sample Output
Enter the length of the room in feet 20
Enter the width of the room in feet 16
Enter the height of the walls in feet 9
Enter the price of one pail of paint 24.99
Enter the sq ft covered by one pail 100
This job requires 7 pails of paint
The cost of paint is $174.93

Solutions

Expert Solution

Python Code:

def wallarea(length,breadth,height):
area=(2*length*height)+(2*breadth*height) #floor and ceiling area is not included
return area;
def cost(area,price,sqft):
pails=area/sqft
import math
pails=math.ceil(pails) #Round up function in math
print("This job requires "+str(pails)+" pails of paint")
a=pails*price
print("The cost of paint is $",end='')
print("%.2f" % round(a,2))
  
def main():
length=int(input("Enter the length of the room in feet ")) #length of the room
breadth=int(input("Enter the breadth of the room in feet ")) #breadth of the room
height=int(input("Enter the height of the walls in feet ")) #height of the room
price=float(input("Enter the price of one pail of paint ")) #price of the room
sqft=float(input("Enter the square feet covered by one pail ")) #sqft covered by pail
area=wallarea(length,breadth,height) #area of the walls in the room
cost(area,price,sqft) #final cost printed in this function
  
if __name__ == "__main__":
main()
  

Screenshot:

Output:

If you have any queries, please comment below.

Please upvote , if you like this answer.


Related Solutions

Write a program that determines the cost of painting the walls of a windowless room. There...
Write a program that determines the cost of painting the walls of a windowless room. There is one door and it will be painted the same color as the walls. The problem requires a main function and two custom functions that are imported from a custom module that you create. In main, the program should prompt the user for five inputs shown in blue in the Sample Output below: the length, width, and height of the room in feet. the...
PYTHON PROGRAM: Write a program that determines the day of the week for any given calendar...
PYTHON PROGRAM: Write a program that determines the day of the week for any given calendar date after January 1, 1900, which was a Monday. This program will need to account for leap years, which occur in every year that is divisible by 4, except for years that are divisible by 100 but are not divisible by 400. For example, 1900 was not a leap year, but 2000 was a leap year.
Calculating Delivery Cost Program in Python write a program in Python that will ask a user...
Calculating Delivery Cost Program in Python write a program in Python that will ask a user to enter the purchase total, the number of the items that need to be delivered and delivery day. Then the system displays the cost of delivery along with the total cost. Purchase total > $150 Yes Number of the items (N) N<=5 N>=6 Delivery day Same Day Next Day Same Day Next Day Delivery charges ($) 8 N * 1.50 N * 2.50 N...
Write a Python program called arecongruent.py that determines whether two integers a and b are congruent...
Write a Python program called arecongruent.py that determines whether two integers a and b are congruent modulo n. Your code must work as follows: From the command prompt the user runs the program by typing python arecongruent.py and then your program interface prompts the user for the values of a, b, and n. The program outputs either True or False, and the values of a mod n and b mod n. Submit your Python source code arecongruent.py. NOTE: please include...
Write a program IN PYTHON of the JUPYTER NOOTBOOK Write a Python program that gets a...
Write a program IN PYTHON of the JUPYTER NOOTBOOK Write a Python program that gets a numeric grade (on a scale of 0-100) from the user and convert it to a letter grade based on the following table. A: 90% - 100% B 80% - 89% C 70% - 79% D 60% - 69% F <60% The program should be written so that if the user entered either a non-numeric input or a numeric input out of the 0-100 range,...
Program must be in Python Write a program in Python whose inputs are three integers, and...
Program must be in Python Write a program in Python whose inputs are three integers, and whose output is the smallest of the three values. Input is 7 15 3
Write a java program using the following instructions: Write a program that determines election results. Create...
Write a java program using the following instructions: Write a program that determines election results. Create two parallel arrays to store the last names of five candidates in a local election and the votes received by each candidate. Prompt the user to input these values. The program should output each candidates name, the votes received by that candidate, the percentage of the total votes received by the candidate, and the total votes cast. Your program should also output the winner...
For Python: In this assignment you are asked to write a Python program to determine the...
For Python: In this assignment you are asked to write a Python program to determine the Academic Standing of a studentbased on their CGPA. The program should do the following: Prompt the user to enter his name. Prompt the user to enter his major. Prompt the user to enter grades for 3 subjects (A, B, C, D, F). Calculate the CGPA of the student. To calculate CGPA use the formula: CGPA = (quality points * credit hours) / credit hours...
In python. Projectile motion: Write a python program that will ask the user for      an...
In python. Projectile motion: Write a python program that will ask the user for      an initial height y0, initial velocity v, launch angle theta, and mass m.      Create two functions, one that will calculate max height      of the projectile, and one that will calculate the range. Ask the     user which one he/she would like to calculate, then present them with the answer. (use kg, m and m/s)
Write a program that determines a student’s grade. The program will read three types of scores...
Write a program that determines a student’s grade. The program will read three types of scores (quiz, mid-term, and final scores) and determine the grade based on the following rules: -if the average score =90% =>grade=A -if the average score >= 70% and <90% => grade=B -if the average score>=50% and <70% =>grade=C -if the average score<50% =>grade=F Using Switch Statement Need to code to be simple to understand. No pointers should be used
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT