“””Task (30 pts total)——————-Given a mock sales…

“””Task (30 pts total)——————-Given a mock sales DataFrame `SALES`, complete the CSV read/load task with all column labels retained.””” SALES = pd.DataFrame(    {        “date”:     [“2025-09-28”, “2025-09-28”, “2025-09-29”, “2025-09-30”,                     “2025-10-01”, “2025-10-01”, “2025-10-02”, “2025-10-02”],        “customer”: [“Alice”, “Bob”, “Alice”, “Dana”, “Eli”, “Bob”, “Faye”, “Charlie”],        “item”:     [“coffee”, “tea”, “cake”, “coffee”, “sandwich”, “coffee”, “tea”, “cake”],        “price”:    [3.50, 2.25, 4.00, 3.50, 6.75, 3.50, 2.25, 4.00],        “quantity”: [2,    3,    1,    4,    2,    1,    5,    2],        “store”:    [“S1”, “S1”, “S2”, “S1”, “S2”, “S1”, “S2”, “S2”],        “region”:   [“West”, “West”, “West”, “West”, “East”, “West”, “East”, “East”],    }) CSV_PATH = “CIS_404_Exam_Exam3_sales.csv” # (1) Save the DataFrame to CSV: 10pts”””Save the given DataFrame `SALES` to a CSV file located at `CSV_PATH`.Your output file must:  – ONLY include all column labels,  – use semicolon (;) as the field separator,  – and otherwise follow the default argument options.””” # TODO: implementraise NotImplementedError # (2) Read the DataFrame back from CSV: 10pts”””Read the CSV file located at `CSV_PATH` into a new DataFrame named `SALES_readback`.Your read statement must:  – correctly read the file that was just saved,  – use semicolon (;) as the field separator,  – and otherwise follow the default argument options.After reading, you should ensure that the columns in `SALES_readback`match the columns in the original `SALES` DataFrame.””” # TODO: implementraise NotImplementedError # testing: # (please comment in)# print(“Read back from CIS_404_Exam_Exam3_sales.csv:\n”, SALES_readback, “\n”) # assert list(SALES_readback.columns) == list(SALES.columns), “Column labels differ.” # (3) Single .loc / .iloc expression: 10pts”””Use a single expression with .loc or .iloc to SELECT FROM `SALES_readback`:  – rows 2 through 5 (inclusive of 2 and exclusive of 6)    – the columns ‘customer’, ‘item’, ‘price’ in that order.Assign the result to a variable named `SALES_subset`.””” # TODO: implementraise NotImplementedError # testing: # (please comment in)# print(“Subset:\n”, SALES_subset, “\n”)

“””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 = [    (“P1001”, 10.0, 2),    (“P1002”, 5.0, 3),    (“P1003″, 2.5, 4),] # 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) # [{‘prod_code’: ‘P1001’, ‘price’: 10.0, ‘quantity’: 2},                                 #  {‘prod_code’: ‘P1002’, ‘price’: 5.0, ‘quantity’: 3},                                #  {‘prod_code’: ‘P1003’, ‘price’: 2.5, ‘quantity’: 4}] 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