Question: Can somebody help me with python code? 1. Dessert Shop Part 7: Payment Method Problem In this part of the project, you will add a
Can somebody help me with python code?



1. Dessert Shop Part 7: Payment Method Problem In this part of the project, you will add a payment method to an order. Payment class The Payment class specifies one attribute, whose value is one of an Enum of type PayType. Possible values for PayType are {CASH,CARD,PHONE}. This property is both readable and writable in subclasses, similar to what you did in Part 6 for Packaging. As in Part 6, you might naturally ask why put this one property in a separate class? Why not just add the attribute to Order and be done? There are three reasons: 1. We could and that would be an easy way to do it, under the assumption that Orders always need a defined payment type. 2. We introduce you to the module and what is available there. 3. We want to design the system so that Payment and PayType are explicit types rather than implicit types. Define this class in in the new module We define it in a separate module to keep the design modular. Changes to Order class - Implement the Payment type. - The default value for pay method in the constructor should be PayType.CASH. - Modify method to include payment type in the order as shown in the example run. - Add a free top-level function that - prompts the user for payment type as shown in the example run - validates the input returns the payment type to the calling code to set the payment type before an order is printed. You may find it helpful that: - There are several different ways to create Enums - Enums are iterable - Enums are comparable - Enums have human readable string representations Test Cases Add test cases to test the payment type of an Order. We are not testing the user interface with automated test cases, just Order objects with new payment types. Example Scenario 1: Candy 2: Cookie 3: Ice Cream 4: Sunday What would you like to add to the order? (1-4, Enter for done): 2 Enter the type of cookie: Oatmeal Raisin Enter the quantity purchased: 4 Enter the price per dozen: 3.45 1: Candy 2: Cookie 3: Ice Cream 4: Sunday What would you like to add to the order? (1-4, Enter for done): 1: Cash 2: Card 3: Phone Enter payment method: 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
