Write a class called Hamburger. The Hamburger class should have the following fields: weight – an int storing the weight of the hamburger patty in ounces doneness – a String which stores how well the burger is cooked i.e., rare, medium, well done, etc. cheese – a boolean indicating whether the burger has cheese or not toppings – a list of Strings storing the toppings on the burger i.e., lettuce, tomato, mayonnaise, etc. The Hamburger class should have the following methods: 1. a constructor 2. getter and setter methods for each of the fields 3. a 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. 4. __str__ method In the same file, write a main function that prompts the user to input 3 hamburgers. The function outputs the hamburgers sorted by the weight. Then use any hamburger object to call each of the class methods to test their functionality.
Write a class called Hamburger.
The Hamburger class should have the following fields:
-
weight – an int storing the weight of the hamburger patty in ounces
-
doneness – a String which stores how well the burger is cooked i.e., rare, medium, well
done, etc.
-
cheese – a boolean indicating whether the burger has cheese or not
-
toppings – a list of Strings storing the toppings on the burger i.e., lettuce, tomato,
mayonnaise, etc.
The Hamburger class should have the following methods: 1. a constructor
2. getter and setter methods for each of the fields
3. a 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. 4. __str__ method
In the same file, write a main function that prompts the user to input 3 hamburgers. The function outputs the hamburgers sorted by the weight. Then use any hamburger object to call each of the class methods to test their functionality.

Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images








