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

Consider the following class definition:s public class Farmer private String cro

ID: 3740492 • Letter: C

Question

Consider the following class definition:s public class Farmer private String crop; public Farmer (String crop) f this.crop-crop; public void setCrop (String crop) ( this. crop = crop; public String getcrop) return crop; public static void Farm) f System.out.println("Work the land. Feed the world"); public class Bob extends Farmer private String emotionalState; public Bob(String emotionalState, String crop) super (crop); this. emotion a!State emotionalstate; = public void getRaise() t System.out.println("gimme a raise!" public String getEmotionalState) return emotionalState public void setEmotionalState (String emotionalState) this. emotionalstate string ( emotionalstate); = new public class Economyf public static void main(String[ ] args) [ Bob Joe -new Bob( "happy", "cheese" Joe.setCrop( "not telling"); Joe.setEmotionalState("disillusioned"); System.out.println(Joe.getEmotionalState(); System.out.println(Joe.getCrop()

Explanation / Answer

the correct option is c)

disillusioned

not telling

since in the main joe object is created with happy and cheese parameters and then using joe object value of crop is set to not telling

and the value of emotionalstate is set to disilusioned using setcrop() and setemotionalState object

and then the values are printed using getemotionalstate() and getcrop()

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