Question: java language. Write a class Animal that stores a String name and an int age. Write a constructor that takes parameters for name and age

java language.java language. Write a class Animal that stores a String name and

Write a class Animal that stores a String name and an int age. Write a constructor that takes parameters for name and age and initializes the name and age. Write a toString method that, for a stored name of "David" and age of 2, would return exactly "name: David age: 2". Test your class by making an Animal with a name of "David" and an age of 2 and then printing it. 1. 2. Write a class Holdlt that stores an instance of a generic object type. Write a constructor that initializes this stored value with a passed in parameter. Write a toString method that prints that stored value and only the stored value. Test your code by making an instance that holds a name "David" and another instance that holds an int 2. Print out both instances. 3. Write a class Cat that inherits from Animal. Write a constructor with no parameters that uses the Animal constructor to set name to "Kitty" and age to 0. Override the toString method to return the Animal toString followed by says: Meow". In main, make a Cat and print it out. Make a GUI in a class called GUITest that uses a JFrame and adds a quit button. If the quit button is pressed, the program should close. 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!