Project 1) Animal Class
(No abstract classes) Create the following ClassesAnimal that should have
- Class variables
- private String name
- private int age
- Constructors
- Single parameter constructor that initializes name
- Default Constructor
- Accessor and mutator methods for both class variables
- Implement the following methods
String toString(); //should return a String that includes both class variables.String makeNoise(); //
- Methods
- void makeNoise() This should print out 'noise'
- Class Dog extends Animal
String breed;boolean isPureBred- void goForWalk();
- partially override the accessor and mutator methods involving the age variable . Remember that 1 human year = 7 dog years.
- Look at the two classes below to see how a sub class could access a private super class variable via public accessor method. (Of course, if you know about the protected modifier, you could use that)
public class Animal{ private int age; public int getAge(){ return age; } } public class Dog extends Animal{ int getAge(){ return super.getAge() * 7; } }
- Look at the two classes below to see how a sub class could access a private super class variable via public accessor method. (Of course, if you know about the protected modifier, you could use that)
- partially override the toString() method addin additional information for the class variables.
public boolean getIsPureBred();-

-
Class Variables
- Additional Methods
- Class Cat extends Animal
Look at the Dog class's instructions and implement the same functionality for a Cat. Calculating cat age is a litle more complicated. Read this link and implement its algorithm.
- Class Duck extends Animal
- look at the last two subclasses as examples for how to write this class. Assume that 1 duck year equals 1 human year.
- class Poodle extends Dog
- class Poodle extends RottWiler
- Both of these classes should ovverride makeNoise();
Poodle
![]() |
Rotweiler
![]() |
The Runner Class: Create a runner Class that demonstrates the functionalities of each type of class

