Question: Please use Java, Thank you. 8-1 Create a class to represent an object of type Animal using the description provided below in UML Animal -
Create a class to represent an object of type Animal using the description provided below in UML Animal - name : String - birthYear : int - weight : double - gender : char + Animal() I/ Set name =n, birthYear=1900, weight =0.0, gender='u' + Animal(String, int, double, char) + getName(): String + setName(String) : void + getBirthYear() : int + setBirthYear(int) : void + getWeight() : double + setWeight(double): void lif input value is negative, set weight to 1 + getGender() : char + setGender(char): void // if input value is not ' m ' or ' f ', set gender to ' u ' (unknown) + calculateAge(int) : int // use birthYear and the argument of currentYear to calculate age. + isMale () : boolean I/ If currentYear
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
