Hire Experts For Answers
Order NowRelated Study Services
- Homework Answers
- Coursework writing help
- Term paper writing help
- Writing Help
- Paper Writing Help
- Research paper help
- Thesis Help
- Dissertation Help
- Case study writing service
- Capstone Project Writing Help
- Lab report Writing
- Take my online class
- Take my online exam
- Do my test for me
- Do my homework
- Do my math homework
- Online Assignment Help
- Do my assignment
- Essay Writing Help
- Write my college essay
- Write my essay for me
DESCRIPTION
Posted
Modified
Viewed
14
I need to have the code written with the use of class methods and instantiation, this is the second half of the introduction to programming (OOP Programming) and I am an undergraduate student so the code cannot be too advanced.
This order does not have tags, yet.
Attachments
Homework Assignment # 2 Due: 10/7 at 11:59 PM
Topics: class, object, instantiation, methods, inheritance
Problem Statement: 209 Burger
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.
i. What are the methods and attributes needed to properly define a subclass?
ii. How to use the __init__ of the superclass?
c. 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 ContactList 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 description
Param (/user options) Return type
__init__() Initializes base burger ingredients. Defines a
AddToCart type object ‘cart’ as class variable.
‘cart’ appends each current object ordered by
a customer.
Bun: white or wheat
Patty: single or double
none
get_price() Returns the price depending on the number
of patties. This one uses simple_burger_price
dictionary to determine the price. (See below
notes**)
None float
__str()__ Returns basic information. See sample I/O None string
Subclasses: CheeseBurger and VeggieBurger:
Design two subclasses CheeseBurger 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.
Method description
Param (/user options) Return type
__init__() 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’.
Three types of veggie toppings for
VeggieBurger class: ‘lettuce’,
‘tomato’ and ‘caramelized onion’
Bun, patty and cheese type
(CheeseBurger subclass)
Bun, patty and veggie topping type
(VeggieBurger subclass)
None
__str()__ Print representation of subclass
object. See sample I/O.
None string
get_price() 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.
None 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 one customer orders. Extension of a list class and has
the following extended method:
Method description
Param (/user
options)
Return type
subtotal() 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.
None float
tax() Applies 3.25% tax on subtotal and returns tax. None float
total() Returns the total price of an order. None 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
******** Printing Receipt *******
0- white-single-7.99
1- wheat-double with pepper jack-11.98
Subtotal: 19.97
Tax: 0.65
Total: 20.62
****** Thanks for coming! ******
Submission:
1. All submission will be via BlackBoard by due time.
2. You can take help from the GTA and instructor, you can look at the class slides and lecture codes and python
documentation.
3. The codes need to be written in the firstname_lastname_HA2.py file. Please change the name of the file and
the header of the file.
Grading Rubrics:
Excellent Average Need Improving Points possible
Submission Both file name and
file header meet
spec
Either file name or
file header is
incorrect
Both file name and
header is missing or
incorrect
___/2
Comments and self-
documentation
Comments clearly
demonstrates
functionality of each
part and variable
names and methods
are meaningful with
proper
documentation.
Comments generally
demonstrates the
functionality of the
code and variable
names and methods
are general with no
proper
documentation.
Comments do not
demonstrate the
functionalities of the
code and variable
names and methods
are not meaningful
and no
documentation is
present
___/3
Implementation The base class,
subclass and
AddToCart class and
methods has been
defined correctly.
The base class,
AddToCart class and
subclass and
methods has been
defined but some
are missing.
The class definition
is incorrect and no
methods are defined
properly.
___/12
I/O and object
creation
Specified standard
input and output are
implemented with
menu and object has
been created
properly
Specified standard
input and output are
implemented and/or
menu but with
minor flaws and/or
object is not created
properly
Specified standard
input and output are
not implemented,
menu is not present
and object creation
is missing
___/8
Total Score __/25
Explanations and Answers
0
No answers posted
Post your Answer - free or at a fee
NB: Post a homework question for free and get answers - free or paid homework help.
Get answers to: Python Coding Question Requiring The Use Of Class Methods And Inheritance or similar questions only at Tutlance.
Related Questions
- Tree-Based Regression Methods For 3D Sinusoidal Data
- Python Homework - Q2: Simple Linear Regression With R2 Calculation
- Python Homework - Q2: Simple Linear Regression With R2 Calculation
- All The Requirements Are Already Listed Below. I Hope To Get An A Grade.
- Data Science Assignment Help Urgent
- Computer Science 100 Class Lab
- Use Turtle Graphics To Draw A Mickey Mouse Head On Python
- Use Turtle Graphics To Draw A Mickey Mouse Head On Python
- Use Turtle Graphics To Draw A Mickey Mouse Head On Python
- Two Data Science Problems Involving Python Notebooks
- Two Data Science Problems Involving Python Notebooks
- Do You Provide Help With College Admissions Essays
- Sas Performing Basic Sas Programing
- The Question Is About A Homework Problem Related To College Grading Book, Details Are Attached Below.
- The Question Is About A Homework Problem Related To College Grading Book, Details Are Attached Below.
- Nursing Statistics Using Stata
- Python Number Guessing Game. I Did The Basic Code But I Keep Getting Errors While Calling The Code
- Color Palette Using Arduino Uno And Processing
- Webgl Program(Javascript File).
- Need 2 Simple Python Programs Based On Lab Exercise.
- Write A Complete Program That Will Do The Steps
- Python Project Program Will Read Files Produced By A High-Throughput Sequencer — A Machine That Takes As Input Some Dna
- Neo4J And Python Programming Tasks In Big Data Tecnologies
- Business Statistics Data Analyst
- Decision Making Analytics Excel Hw
- Decision Making Analytics Excel Hw
- Basic Coding Question (Python)
- Data Cleaning, Binning, Encoding, Feature Engineering
- Data Cleaning, Binning, Encoding, Feature Engineering
- Data Cleaning, Binning, Feature Engineering, Encoding
- Quantitative Research Analysis
- Can You Help Me Do This Assignment?
- Computer Vision Sift Assignment
- Language Proficiency Scores Programming
- Language Proficiency Scores Programming
- I Need Help Making Maps Of Pompano Beach, Fl On Arc Gis Pro
- I Need Help Making Maps Of Pompano Beach, Fl On Arc Gis Pro
- Console Application
- Build Gui Using Java Language For Snake Game And Ship Simulators.
- Common App Personal Essay Of Your Choice
- Matlab Hw Need S To Be Done By 1030 Tomorrow Please
- Mixed Models Online Exam - Stats + R
- Mixed Models Online Exam - Stats + R
- Streaming Log Analytics ( Only Open Source Tools To Be Used For Data Pipeline)
- Using Python Computing Services
- Using Python Computing Services
- Assignment To Write A C Program That Implements A Singly Linked List
- Write An R Programming Assignment On Factor Analysis
- Classification With Glms, Trees, Svms
- Python/R Script To Evaluate Several Files