“””Task (30 pts total)——————-Create a simple bus…
“””Task (30 pts total)——————-Create a simple business object that computes total revenue for a customer order. Part 1 (18pts): Constructor (__init__): Write a class Order with: – __init__(self, order_id: str, customer: str, item_tuples: list) * Store the arguments `order_id` and `customer` as instance attributes. * item_tuples is provided as a list of tuples, each in the form: (prod_code, price, quantity) where `prod_code` is a string, `price` is a float, and `quantity` is an integer. Here “prod_code” is a short product identifier (e.g., “P1001”). * Inside __init__, convert this list of tuples into a list of dictionaries, {“prod_code”: …, “price”: …, “quantity”: …}, and store it in self.items. Part 2 (6pts): Method (total_revenue): Implement total_revenue(self) -> float * Calls safe_line_total(item, 0.15) for each item to apply a 15% discount. * Returns the total after discount. Part 3 (6pts): Function (safe_line_total): Define safe_line_total(item: dict, discount: float) -> float * Computes: price × quantity × (1 – discount) * discount is a decimal reduction (e.g., 0.10 means 10% off)””” class Order: “””Simple business object representing a customer’s order.””” # (1) Constructor: 5pt + 5pts + 8pts = 18pts def __init__(self, order_id: str, customer: str, item_tuples: list): self.order_id = … # TODO: implement self.customer = … # TODO: implement # convert list of tuples to list of dicts (use tuple unpacking for clarity) self.items = … # TODO: implement raise NotImplementedError # (2) Method: 6pts def total_revenue(self) -> float: “””Return total revenue after 15% discount on all items.””” # TODO: implement raise NotImplementedError # (3) Helper Function: 6ptsdef safe_line_total(item: dict, discount: float) -> float: “””Compute line revenue for one item with a given discount rate.””” # TODO: implement raise NotImplementedError # testing:# sample input dataitem_tuples = # instantiate the Orderorder = Order(order_id=”O123″, customer=”Yankun”, item_tuples=item_tuples) # print testing infoprint(“testing:”)print(” order_id =”, order.order_id) # O123print(” customer =”, order.customer) # Yankunprint(” items =”, order.items) # total = order.total_revenue()print(“\ncomputed total revenue (after 15% discount):”, total)# expected:# items: (10*2) + (5*3) + (2.5*4) = 20 + 15 + 10 = 45# after 15% discount → 45 * 0.85 = 38.25# computed total revenue (after 15% discount): 38.25