Question: Design and implement a program with a class called Animal that contains the methods getSound, setSound, getType, and setType as well as all of the
Design and implement a program with a class called Animal that contains the methods getSound, setSound, getType, and setType as well as all of the appropriate constructors, class variables, toString, etc. It should run with the following driver class without modification.
public class AnimalDriver {
public static void main(String[] args) {
Animal dog = new Animal(); dog.setType("dog"); dog.setSound("woof"); Animal cat = new Animal("meow", "cat"); System.out.println(cat); System.out.println(dog); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
