Write a Snack class as a subclass of Product. In addition to description and pri
ID: 3819841 • Letter: W
Question
Write a Snack class as a subclass of Product. In addition to description and price, Snack has integer instance variable gramsOfFat.
Write a method getGramsOfFat.
Write a method isHealther which returns true if this Snack has fewer grams of fat than the parameter Snack.
Include toString and equals.
Snack should implement Comparable interface. Snacks are ordered first by gramsOfFat with the Snack with the fewer grams of fat coming first. If the grams of fat are the same order by price with the lowest price coming first, If prices are also equal, order alphabetically by description
Implement the Clonable interface.
Use the following files:
**************************Product.java***********************************
*********************SnackTester.java**************************
Explanation / Answer
*********************SnackTester.java**************************
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.