Using Python 3.5 or later wirte the following program, and include comments for
ID: 3793563 • Letter: U
Question
Using Python 3.5 or later wirte the following program, and include comments for what is being done so better understanding of the program. I am quite stuck on this program.
Write a class called Hamburger.
The Hamburger class should have the following PRIVATE fields;
cookLevel– a String which stores how well the burger is cooked i.e., rare, medium, well done, etc.
weight – A int storing the weight of the hamburger meat, in ounces.
cheese – a boolean indicating whether the burger has cheese or not.
toppings – a list of Strings storing the toppings on the burger - ketchup, lettuce, tomato, onions, mayonnaise and pickles.
The Hamburger class should have the following methods:
A constructor.
Getter and setter methods for each of the fields.
Bite method – the bite methods should reduce the weight of the burger by 1 ounce each time it’s called, until the weight is 0.
__str__ method.
In the same file, write a main function to test the functionality of the Hamburger class.
Explanation / Answer
Please find the code below
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.