Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started