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


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()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
