-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLion.java
52 lines (34 loc) · 1.03 KB
/
Lion.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
40
41
42
43
44
45
46
47
48
49
50
51
52
package ZooManagementSystem;
public class Lion extends CarnivorousAnimal{
private final double MeatCalcMale=0.02;
private final double MeatCalcFemale=0.03;
private final int MaxMeatinKg=25;
private String Lion_Noise = "ROAR";
public Lion() {
super();
}
public Lion(String name, int age, double weight, Gender gender) {
super(name,age,weight,gender);
}
public int howMuchMeatDoesLionEat() {
double meat = (int)getWeight()*getAge();
if(getGender() == Gender.Male) {
meat=MeatCalcMale;
if(meat>MaxMeatinKg)
return MaxMeatinKg;
else return (int)meat;
}
else {
meat*=MeatCalcFemale;
if(meat>MaxMeatinKg)
return MaxMeatinKg;
else return (int)meat;
}
}
public double feed() {
return howMuchMeatDoesLionEat();
}
public String makeNoise(){
return Lion_Noise;
}
}