Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Eating Gobstoppers Everlasting Gobstoppers are candy that have different flavore

ID: 440941 • Letter: E

Question

Eating Gobstoppers Everlasting Gobstoppers are candy that have different flavored layers around a sweet-tart candy sphere. For this assignment, you will design a set of classes that work together (collaborate) to simulate eating a Gobstopper. The classes you will design are the following: The Gobstopper Class: This class will simulate a Gobstopper. Its responsibilities are as follows: Fields (the things the class knows):

Explanation / Answer

I have created three classes as mentioned above and is working fine i have checked it in eclips. -------------------------------- GobStopper Class ------------------------------------ public class GobStopper { String[] flavors={"Grape","Cherry","Orange"}; final int MAXIMUM_LICKS=100; int remainingLicks=100; final int CALORIES_PER_LICK=10; public String getCurrentFlavor() { int noOfLickPerFlavor=MAXIMUM_LICKS/3; int currentFlavor=0; if(remainingLicks>=67&&remainingLicks=34&&remainingLicks0) remainingLicks--; return CALORIES_PER_LICK; } } ----------------------------------- GobStopperEaterClass ----------------------------------- public class GobStopperEater { int caloricIntake=0; public int getCaloricIntake() { return caloricIntake; } public void lick(GobStopper gob) { int noOfCaloriGained; noOfCaloriGained=gob.lick(); caloricIntake+=noOfCaloriGained; } } --------------------------------------- EatingGobStopper class ----------------------------------- public class EatingGobStopper { public static void main(String[] args) { GobStopper gobStopper=new GobStopper(); GobStopperEater gobStopperEater =new GobStopperEater(); System.out.println("Eating started"); System.out.println("********************************"); for(int i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote