Question: Please develop a Java program which: You are NOT allowed to modify the Mammal class or Test class. Given the abstract class Mammal and the
Please develop a Java program which:
You are NOT allowed to modify the Mammal class or Test class.
Given the abstract class Mammal and the driver class Test, please implement the Human class and Programmer class so that when executed, the program displays:
Human eats anything that moves
Human reads anything that is interesting
Human eats anything that moves
SuperOne reads bits and bytes
SuperOne develops software systems
public class Test { // You are NOT allowed to change this class. public static void main(String []args) { Mammal m = new Human(); m.eat(); m.read(); m = new Programmer("SuperOne"); m.eat(); m.read(); ((Programmer) m).work(); } // main } // Test abstract class Mammal { // You are NOT allowed to change this class. String name; public abstract void eat(); public void read() { System.out.println("Reading..."); } } // Mammal I use JGRASP so it must be in one Java file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
