-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lynx.java
39 lines (29 loc) · 870 Bytes
/
Lynx.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package ZooManagementSystem;
public class Lynx extends CarnivorousAnimal{
private final String Lynx_Noise = "RAAAHHH";
private final double MeatCalcMale = 1.1;
private final double MeatCalcFemale= 1.3;
public Lynx(){
super();
}
public Lynx(String name, int age, double weight, Gender gender) {
super(name,age,weight,gender);
}
public int howMuchMeatDoesLynxEat() {
double meat = (int)(getWeight()*0.1 + getAge()*2);
if(getGender() == Gender.Male) {
meat *= MeatCalcMale;
return (int)(meat);
}
else {
meat *= MeatCalcFemale;
return (int)(meat);
}
}
public String makeNoise() {
return Lynx_Noise;
}
public double feed() {
return howMuchMeatDoesLynxEat();
}
}