Inheritance
a. Create a java program for a class named Animal to allow the following private data members:
§ Include integer values named lifeExpectancy and weight.
§ Include a character value named gender and a String value called name.
§ Allow for a public String value called type.
§ Design an Animal() constructor with parameters to accept values for each data member.
§ Design a public void method printValues() with no parameters that displays all data members for the object of the Animal class.
Animal |
- lifeExpectancy: int
- weight: int
- gender: char
- name: String
+ type: String |
+ Animal(char, int, String, int, String)
+ printValues( ): void |