Design and implement a simple burger takeout for class 209. The purpose of this lab is...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Design and implement a simple burger takeout for class 209. The purpose of this lab is to gain experience in python's class, class variable, instance variable, methods and inheritance and extending built-ins. Program Design: 1. Before starting of the program draw a general outline of your code. Think about it from the operational perspective: a. What should be the base class? Hint: Think about a Simple Burger class. i. What are the methods and attributes that are common among all the classes? ii. Hint: All burgers have bun and patty count as instance variable. b. What should be your sub classes? Can you identify the IS-A relationships? Hint: Different types of burger: cheese, and veggie toppings since they vary by ingredients. Simple burger does not have Cheese as toppings. C. i. What are the methods and attributes needed to properly define a subclass? ii. How to use the _init___ of the superclass? We will need a cart list which will contain all the burger objects one customer orders. The list class will also calculate the subtotal and total price (After applying tax) for an order. Hint: Remember how we extended a list class while designing our Contact class by adding a search method to Contact List object? (Lecture on Inheritance: Extending built-ins.) 2. Based on the information from the step 1, write the class definition and methods. 3. You can design a simple main function for user data and based on type of burger, create the objects. a. Hint: Main function takes user input on type, bun, patty count. Depending on the type create an object. Once an object is created, it will be added to the cart list object b. Design the main menu structure as provided in the sample I/O. 4. Display subtotal and tax and total at the end of the program as a receipt to the customer. Hint: This will involve calling methods from cart list class. Class, Methods and attributes: Base class: SimpleBurger Method _init__() get_price() Method description Returns the price depending on the number of patties. This one uses simple_burger_price dictionary to determine the price. (See below notes**) _str()____ Returns basic information. See sample 1/0 None _init_() _str()_ get_price() Initializes base burger ingredients. Defines a AddToCart type object 'cart' as class variable. 'cart' appends each current object ordered by Patty: single or double a customer. None description Initializes subclass objects. Apart from basic ingredients, it initializes the ingredient type. There can be two types of cheese for CheeseBurger class: 'american' and 'pepper jack'. Param (/user options) Subclasses: CheeseBurger and VeggieBurger: Design two subclasses Cheese Burger and VeggieBurger. Following are class components. Three subclasses are polymorphic since they all share common interface, however depending on the type the outcome will be different. Three types of veggie toppings for VeggieBurger class: 'lettuce', 'tomato' and 'caramelized onion' Print representation of subclass object. See sample I/O. Calcualtes and then returns the price of a burger object. The price of a special burger object is price of a simple burger object plus the price based on type (see below note)**. Define a dictionary as a class variable in each subclass and access the price using the type. Bun: white or wheat Param (/user options) Bun, patty and cheese type (CheeseBurger subclass) None Bun, patty and veggie topping type (VeggieBurger subclass) None Return type none float string Return type None string float **Price is determined by type/number of patties in the burger-simple burger can be 'single' or 'double' patties where single costs 7.99$ and double is 10.99$. If a customer chooses single patty cheese burger, then it will be 7.99 plus additional cheese price will be added. Cheese price is determined by the cheese_type_price dictionary. All these dictionaries are defined as class variable in each class. Following is a sample dictionary can be used to determine the price: simple_burger_price = {'single': 7.99, 'double': 10.99} #class variable in SimpleBurger class cheese_type_price = {'american': 1.99, 'pepper jack': 0.99} #class variable in CheeseBurger class veggie_type_price = {"lettuce': 0.99, 'tomato': 0.99, 'caramelized onion': 2.99} #class variable in VeggieBurger class AddToCart - a list subclass: Contains the burger information for each burger object a customer orders. Extension of a list class and has the following extended method: Method subtotal() tax() total() description Returns subtotal of the order. One order represents one customer and can contain multiple burgers. Obtain the summation of all the burger object in the cart. Hint: think about iterative over using a for loop on list object and then use get_price () method to obtain price for each object. Applies 3.25% tax on subtotal and returns tax. Returns the total price of an order. Param (/user options) None None None Return type float float float Sample I/O: ****** Welcome to 209 Burger Enter type of Burger(simple/cheese/veggie): simple Enter bun type (white/wheat): white Enter patty count (single/double): single Do you want to continue ordering (yes/no): yes Enter type of Burger(simple/cheese/veggie): cheese Enter bun type (white/wheat): wheat Enter patty count (single/double): double Enter cheese type (american/pepper jack): pepper jack Do you want to continue ordering (yes/no): no 0- 1- ****** Printing Receipt' white-single-7.99 wheat-double with pepper jack-11.98 Subtotal: 19.97 Tax: 0.65 Total: 20.62 ****** Thanks for coming! ** Design and implement a simple burger takeout for class 209. The purpose of this lab is to gain experience in python's class, class variable, instance variable, methods and inheritance and extending built-ins. Program Design: 1. Before starting of the program draw a general outline of your code. Think about it from the operational perspective: a. What should be the base class? Hint: Think about a Simple Burger class. i. What are the methods and attributes that are common among all the classes? ii. Hint: All burgers have bun and patty count as instance variable. b. What should be your sub classes? Can you identify the IS-A relationships? Hint: Different types of burger: cheese, and veggie toppings since they vary by ingredients. Simple burger does not have Cheese as toppings. C. i. What are the methods and attributes needed to properly define a subclass? ii. How to use the _init___ of the superclass? We will need a cart list which will contain all the burger objects one customer orders. The list class will also calculate the subtotal and total price (After applying tax) for an order. Hint: Remember how we extended a list class while designing our Contact class by adding a search method to Contact List object? (Lecture on Inheritance: Extending built-ins.) 2. Based on the information from the step 1, write the class definition and methods. 3. You can design a simple main function for user data and based on type of burger, create the objects. a. Hint: Main function takes user input on type, bun, patty count. Depending on the type create an object. Once an object is created, it will be added to the cart list object b. Design the main menu structure as provided in the sample I/O. 4. Display subtotal and tax and total at the end of the program as a receipt to the customer. Hint: This will involve calling methods from cart list class. Class, Methods and attributes: Base class: SimpleBurger Method _init__() get_price() Method description Returns the price depending on the number of patties. This one uses simple_burger_price dictionary to determine the price. (See below notes**) _str()____ Returns basic information. See sample 1/0 None _init_() _str()_ get_price() Initializes base burger ingredients. Defines a AddToCart type object 'cart' as class variable. 'cart' appends each current object ordered by Patty: single or double a customer. None description Initializes subclass objects. Apart from basic ingredients, it initializes the ingredient type. There can be two types of cheese for CheeseBurger class: 'american' and 'pepper jack'. Param (/user options) Subclasses: CheeseBurger and VeggieBurger: Design two subclasses Cheese Burger and VeggieBurger. Following are class components. Three subclasses are polymorphic since they all share common interface, however depending on the type the outcome will be different. Three types of veggie toppings for VeggieBurger class: 'lettuce', 'tomato' and 'caramelized onion' Print representation of subclass object. See sample I/O. Calcualtes and then returns the price of a burger object. The price of a special burger object is price of a simple burger object plus the price based on type (see below note)**. Define a dictionary as a class variable in each subclass and access the price using the type. Bun: white or wheat Param (/user options) Bun, patty and cheese type (CheeseBurger subclass) None Bun, patty and veggie topping type (VeggieBurger subclass) None Return type none float string Return type None string float **Price is determined by type/number of patties in the burger-simple burger can be 'single' or 'double' patties where single costs 7.99$ and double is 10.99$. If a customer chooses single patty cheese burger, then it will be 7.99 plus additional cheese price will be added. Cheese price is determined by the cheese_type_price dictionary. All these dictionaries are defined as class variable in each class. Following is a sample dictionary can be used to determine the price: simple_burger_price = {'single': 7.99, 'double': 10.99} #class variable in SimpleBurger class cheese_type_price = {'american': 1.99, 'pepper jack': 0.99} #class variable in CheeseBurger class veggie_type_price = {"lettuce': 0.99, 'tomato': 0.99, 'caramelized onion': 2.99} #class variable in VeggieBurger class AddToCart - a list subclass: Contains the burger information for each burger object a customer orders. Extension of a list class and has the following extended method: Method subtotal() tax() total() description Returns subtotal of the order. One order represents one customer and can contain multiple burgers. Obtain the summation of all the burger object in the cart. Hint: think about iterative over using a for loop on list object and then use get_price () method to obtain price for each object. Applies 3.25% tax on subtotal and returns tax. Returns the total price of an order. Param (/user options) None None None Return type float float float Sample I/O: ****** Welcome to 209 Burger Enter type of Burger(simple/cheese/veggie): simple Enter bun type (white/wheat): white Enter patty count (single/double): single Do you want to continue ordering (yes/no): yes Enter type of Burger(simple/cheese/veggie): cheese Enter bun type (white/wheat): wheat Enter patty count (single/double): double Enter cheese type (american/pepper jack): pepper jack Do you want to continue ordering (yes/no): no 0- 1- ****** Printing Receipt' white-single-7.99 wheat-double with pepper jack-11.98 Subtotal: 19.97 Tax: 0.65 Total: 20.62 ****** Thanks for coming! **
Expert Answer:
Related Book For
Statistics For Business And Economics
ISBN: 9780321826237
12th Edition
Authors: James T. McClave, P. George Benson, Terry T Sincich
Posted Date:
Students also viewed these programming questions
-
Northern Virginia Community College HOW MUCH FINANCIAL RISK SHOULD YOU TAKE? Mark D. D'Antonio Nova Southeastern University FORT LAUDERDALE, FLORIDA, U.S.A. Abstract A successful retirement...
-
Dickens, Kristen, is enrolled as a doctoral student in the Counselor Education at the University of New Orleans. She is a registered counselor intern in the state of Louisiana and works at a...
-
(a) Employing the intercept technique, determine the average grain size for the steel specimen whose microstructure is shown in Figure (a); use at least seven straight-line segments. (b) Estimate the...
-
A hand-held shopping basket 62.0 cm long has a 1.81-kg carton of milk at one end, and a 0.722-kg box of cereal at the other end. Where should a 1.80-kg container of orange juice be placed so that the...
-
The unadjusted trial balance of La Mesa Laundry at August 31, 20Y5, the end of the fiscal year, follows: The data needed to determine year-end adjustments are as follows: (a) Wages accrued but not...
-
Water flows over a broad-crested weir that has a width of \(4 \mathrm{~m}\) and a height of \(P_{w}=1.5 \mathrm{~m}\). The free-surface well upstream of the weir is at a height of \(0.5 \mathrm{~m}\)...
-
Assume the following data for Quality Care Dry Cleaning for the year ended December 31. Gross earnings $355,600.00 All employees salaries are greater than $7,000 in the fi rst quarter of employment...
-
Find f-1 (x) for f (x) = 15 + 12x.
-
Solve these limits: lim 2-7x +1D -5 --10 (2) lim X->>-1 (3) lim +90 lim h0 (6) lim X->3 T (x + 1) lim y Sin(t) t h 5 lim 7x-2x +99 x-> 00 -3-3x 312h 2 x-x x-9 lim lim Sin(x) x-> Sin (0) lim 070 3
-
HEAL11912G Indigenous Peoples & Health Care in Canada The format of a Reflective Paper differs from that of a normal argumentative or research paper. A Reflective Paper is more of a well-structured...
-
In anticipation of the new oPhone and Astronote, you decide to invest some of your $17,000 savings in the Mandarin (M) and Tri-Star (TS) stocks. The current stock prices are $112.70 for Mandarin and...
-
Let W= = (b) 3 { [ [29] 3 3w+ 2x + 2y + 4z = 5w+ 4x + 2y + 4z EW E W W = span True True 5w+4x + 2y + 4z 2w + 3x + 5y + 3z. False (c) Show that W is a subspace of M2x2(F7). by writing W as the span of...
-
An Australian bushman hunts kangaroos with the following weapon, a heavy rock tied to one end of a light vine of length 2 m . He holds the other end above his head, at a point 2 m above ground level,...
-
Answer the following questions regarding analysing loan portfolio information, show your workings for the calculation: A) Use the following information to establish how much Bank A's loan portfolio...
-
whe . . Let p be a prime & D, be Hthe set of rat of DP a in lowest form with b= bR, k>o. nos 9. Show that under D. s an + & * of integral domain Is it a field? with
-
Find the center of mass of a thin triangular plate bounded by the y-axis and the lines y = x and y = 2 - x if (x, y) = 6x + 3y + 3.
-
Fugitive dust plumes generated by farm equipment can be hazardous to human health. In the Journal of Agricultural, Biological, and Environmental Sciences (Mar. 2001). environmental engineers...
-
A second experiment involved only the group 2 subjects. In part A of the experiment, these 84 subjects were informed of the hazards (both fire and theft) of owning a valuable painting but were not...
-
"Reader-response cards" are used by marketers to advertise their product and obtain sales leads. These cards are placed in magazines and trade publications. Readers detach and mail in the cards to...
-
How does the estimated ending inventory impact the individual income tax return ending inventory, cost of goods sold, net profit, and net income? Find out by adding an additional column for 2015 and...
-
Input information from the SBA Personal Financial Statements given to Sharptop Bank into a spreadsheet. a. Separate personal items (e.g., residence) from business items (e.g., inventory). b....
-
If the tax return or insurance claim is misstated, did Greg Larsen commit some form of financial statement fraud?
Study smarter with the SolutionInn App