Question: import mathdef calculate _ room _ area ( width , length ) : Calculate room area. Args: width ( int ) : Room width. length

import mathdef calculate_room_area(width, length):Calculate room area.Args:width (int): Room width.length (int): Room length.Returns:int: Room area.return width * lengthdef calculate_carpet_cost(price, area):Calculate carpet cost with waste.Args:price (float): Carpet price per square foot.area (int): Room area.Returns:float: Carpet cost.return (area * price)*1.2def calculate_labor_cost(area):Calculate labor cost.Args:area (int): Room area.Returns:float: Labor cost.return area *0.75def calculate_sales_tax(carpet_cost, labor_cost):Calculate sales tax.Args:carpet_cost (float): Carpet cost.labor_cost (float): Labor cost.Returns:float: Sales tax.return (carpet_cost + labor_cost)*0.07def main():total_sales =0num_orders = int(input("Enter number of orders: "))for i in range(num_orders):print(f"
Enter order {i+1} details:")price = float(input("Carpet price per square foot: "))width = int(input("Room width: "))length = int(input("Room length: "))area = calculate_room_area(width, length)carpet_cost = calculate_carpet_cost(price, area)labor_cost = calculate_labor_cost(area)tax = calculate_sales_tax(carpet_cost, labor_cost)total_cost = carpet_cost + labor_cost + taxprint(f"
Order #{i+1}")print(f"Room: {width}x{length} sq ft")print(f"Carpet: ${carpet_cost:.2f}")print(f"Labor: ${labor_cost:.2f}")print(f"Tax: ${tax:.2f}")print(f"Cost: ${total_cost:.2f}
")total_sales += total_costprint(f"Total Sales: ${total_sales:.2f}")if __name__=="__main__":main()*Example Usage*Input:21.1015121.25818Output:Enter order 1 details:Carpet price per square foot: 1.10Room width: 15Room length: 12Order #1Room: 15x12 sq ftCarpet: $237.60Labor: $135.00Tax: $25.30Cost: $397.90Enter order 2 details:Carpet price per square foot: 1.25Room width: 8Room length: 18Order #2Room: 8x18 sq ftCarpet: $216.00Labor: $108.00Tax: $22.68Cost: $346.68Total Sales: $744.58
Screen shorth of execution

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!