Home / Expert Answers / Computer Science / please-do-not-copy-and-paste-this-python-code-again-the-output-is-wrong-import-math-def-computew-pa222

(Solved): Please do not copy and paste this python code again. The output is wrong. import math def computeW ...



Please do not copy and paste this python code again. The output is wrong.

import math

def computeWindowsDoorsArea():
    print("How many windows and doors does the room contain?")
    w_d = int(input())
    total = 0
    for i in range(w_d):
        print(f"Enter the length of window/door {i+1} in feet.")
        val = int(input())
        print(f"Enter the width of window/door {i+1} in feet.")
        total += val*int(input())
    return total

def computeRectangleWallsArea():
    print("Enter the length of the room in feet")
    l = int(input())
    print("Enter the widht of the room in feet")
    w = int(input())
    print("Enter the height of the room in feet")
    h = int(input())
    return 2 * \
        calculateRectangleArea(
            l, h) + 2 * calculateRectangleArea(w, h) - computeWindowsDoorsArea()

def calculateRectangleArea(l, h):
    return l*h

def computeSquareWallsArea():
    print("Enter the length of one side of the room in feet.")
    val = int(input())
    return computeSquareArea(val)-computeWindowsDoorsArea()

def computeSquareArea(val):
    return val*val

def computeCustomWallsArea():
    print("How many walls are in this room?")
    walls = int(input())
    total = 0
    for i in range(walls):
        print(f"Enter the height of wall {i+1} in feet.")
        val = int(input())
        print(f"Enter the length of wall {i+1} in feet.")
        total += val*int(input())
    return total - computeWindowsDoorsArea()

def computeGallons(total_area):
    return math.ceil(total_area/400)

def computePaintPrice(total_area):
    return computeGallons(total_area)*30*1.3

def computerRoomArea(roomNumber):
    total_area = 0
    for i in range(roomNumber):
        print(f"Room {i+1}")
        print('''Select the shape of the room:
1 – Rectangular
2 – Square
3 – Custom (more or less than four walls. All walls square or rectangular)''')
        val = int(input())
        if val == 1:
            area = computeRectangleWallsArea()
            print(f"For Room {i+1}, the area to be painted is {area} ft2 and will require {computeGallons(area)} gallons of paint. This will cost the customer ${computePaintPrice(area)}")
            total_area += area

        elif val == 2:
            area = computeSquareWallsArea()
            print(f"For Room {i+1}, the area to be painted is {area} ft2 and will require {computeGallons(area)} gallons of paint. This will cost the customer ${computePaintPrice(area)}")
            total_area += area

        elif val == 3:
            area = computeCustomWallsArea()
            print(f"For Room {i+1}, the area to be painted is {area} ft2 and will require {computeGallons(area)} gallons of paint. This will cost the customer ${computePaintPrice(area)}")
            total_area += area

        else:
            print("Invalid Input")
    print(f"The total area to be painted is {total_area} feet and will require {computeGallons(total_area)} gallons of paint. This will cost the customer ${computePaintPrice(total_area)}.")

print("Welcome to Shiny Painting for indoor painting!")
print("How many rooms do you want to paint?")
rooms = int(input())
computerRoomArea(rooms)

Shiny Painting (SP) is an established small business that wants to become a national business by expanding across Canada. SP - The application should use functions to ensure the usability of the code.
- When the user opens the application, the progra- Program calculations shall be based on:
The following constants:
- Paint coverage in square feet per gallon \( \left(\mathrTest Plan
Expected output
Welcome to Shiny Paint Company for indoor painting!
How many Rooms do you want to paint:
3
Thank yoEnter window/door length for window/door 2 in feet
5
Enter window/door width for window/door 2 in feet
8
For Room: 1 , the arFor Room: 2 , the area to be painted is \( 800.0 \) square \( \mathrm{ft} \) and will require \( 2.29 \) gallons to paint. ThEnter window/door width for window/door 1 in feet
10
For Room: 3, the area to be painted is \( 470.0 \) square \( \mathrm{ft}

Shiny Painting (SP) is an established small business that wants to become a national business by expanding across Canada. SP is known for providing high-quality interior painting services at a fair price. The company has developed their reputation by hiring trustworthy, experienced professionals and by providing same-day accurate quotes. Shiny Painting executives have recognized that the company's current quotation process is outdated and relies too heavily on manual calculations. They have requested your help in developing an application to streamlines the process. The application needs to be able to calculate the total interior surface area to be painted, the amount of paint needed, and the total cost of the job, including supplies and labour. The executives remind you that a typical room in a house has four walls, with opposite walls being equal. Walls can be rectangular or square in shape. Some of rooms, however, might have fewer than four walls or more than four. - The application should use functions to ensure the usability of the code. - When the user opens the application, the program should show a welcome message. - Ask the user to input the number of rooms to be painted. - Be sure to indicate what units are being used for all inputs and outputs. - Ensure that the application collects information for each room separately, asking for the number and shape of the surfaces to be painted, as well as features such as windows or doors. Ask the customer if the room shape is square (all four walls to be painted), rectangular (all four walls to be painted) or custom. If the user selects rectangular walls, ask them to enter the width, length and height of the room. If the user selects square walls, ask them to enter just one wall dimension. If the user selects custom, ask them for the number and dimensions of each wall to be painted. - For all room types, the application should ask the user how many windows and doors the room contains and their dimensions. - Program outputs must include: - For each room: the surface area to be painted, how many gallons of paint are required, and the total cost of painting that room. The overall total surface area to be painted in the house, how many gallons of paint are required, and the total cost of painting the whole house. Note: Total cost includes the cost of labour, materials and a profit marqin. - Program calculations shall be based on: The following constants: - Paint coverage in square feet per gallon \( \left(\mathrm{ft}^{2} / \mathrm{gal}\right)=350 \) square feet - Cost of each gallon of paint \( (\$ \mathrm{CDN} / \mathrm{gal})=\$ 42 \) - Labour costs (assume labour cost is included in the cost of paint) Area of a wall in a rectangle room \( = \) (length or width) \( { }^{*} \) height Area of a wall in a square room \( = \) length * height - Wall area to be painted = the area of the wall minus the sum of the area of all the windows and doors on that wall. - You must use the following functions to perform all required operations: Test Plan Expected output Welcome to Shiny Paint Company for indoor painting! How many Rooms do you want to paint: 3 Thank you! Room: 1 Select the shape of the room: 1 - Rectangular 2 - Square 3 - Custom (more or less than 4 walls, all square or rectangles) 1 Enter the length of the room in feet: 16 Enter the width of the room in feet: 20 Enter the height of the room in feet: 15 How many windows and doors does the room contain? 2 Enter window/door length for window/door 1 in feet 5 Enter window/door width for window/door 1 in feet 12 Enter window/door length for window/door 2 in feet 5 Enter window/door width for window/door 2 in feet 8 For Room: 1 , the area to be painted is \( 980.0 \) square \( \mathrm{ft} \) and will require \( 2.80 \) gallons to paint. This will cost the customer \( \$ 117.60 \) Room: 2 Select the shape of the room: 1 - Rectangular 2 - Square 3 - Custom (more or less than 4 walls, all square or rectangles) 2 Enter the length of one side of the room: 15 How many windows and doors does the room contain? 2 Enter window/door length for window/door 1 in feet 5 Enter window/door width for window/door 1 in feet 8 Enter window/door length for window/door 2 in feet 5 Enter window/door width for window/door 2 in feet 12 For Room: 2 , the area to be painted is \( 800.0 \) square \( \mathrm{ft} \) and will require \( 2.29 \) gallons to paint. This will cost the customer \( \$ 96.00 \) Room: 3 Select the shape of the room: 1 - Rectangular 2 - Square 3 - Custom (more or less than 4 walls, all square or rectangles) 3 How many walls are there in the room 3 Enter the height of wall 1 in feet 15 Enter the length of wall 1 in feet 12 Enter the height of wall 2 in feet 15 Enter the length of wall 2 in feet 10 Enter the height of wall 3 in feet 15 Enter the length of wall 3 in feet 12 How many windows and doors does the room contain? 1 Enter window/door length for window/door 1 in feet Enter window/door width for window/door 1 in feet 10 For Room: 3, the area to be painted is \( 470.0 \) square \( \mathrm{ft} \) and will require \( 1.34 \) gallons to paint. This will cost the customer \( \$ 56.40 \) Area to be painted is \( 2250.00 \) square \( \mathrm{ft} \) and will require \( 6.43 \) gallons to paint. This will cost the customer \( \$ 270.00 \)


We have an Answer from Expert

View Expert Answer

Expert Answer


Python Program to calculate the total cost to paint a house: # function to calculate the area of the doors or windows def computeWindowsDoorsArea(): p
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe