-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBug.java
More file actions
67 lines (52 loc) · 1.54 KB
/
Copy pathBug.java
File metadata and controls
67 lines (52 loc) · 1.54 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import java.util.ArrayList;
public class Bug {
protected BugType type;
protected PlantType whichPlantEats;
protected double destructionRate;
public Bug(BugType t, PlantType w, double d) {
type = t;
whichPlantEats = w;
destructionRate = d;
}
BugType getType() {
return type;
}
PlantType getWhichPlantEats() {
return whichPlantEats;
}
double getDestructionRate() {
return destructionRate;
}
}
class Aphid extends Bug{
Aphid(){
super(BugType.aphid, PlantType.strawberry, 0.001); //picked a plant for each bug to eat and made destruction rate
}} //to be 1/10 of growth rate ie. if more than of type of bug than neg growth
class Caterpillar extends Bug {
public Caterpillar(){
super(BugType.caterpillar, PlantType.basil, 0.000625); }}
class Mite extends Bug{
Mite(){
super(BugType.mite, PlantType.sunflower,0.0075); }}
class Ants extends Bug{
Ants(){
super(BugType.ants, PlantType.rose, 0.001); }}
class Whiteflies extends Bug{
Whiteflies(){
super(BugType.whiteflies, PlantType.daisy, 0.002); }}
class mealyBug extends Bug{
mealyBug(){
super(BugType.mealyBug, PlantType.cucumber, 0.004); }}
class Thrips extends Bug{
Thrips(){
super(BugType.thrips, PlantType.tomato, 0.0175); }}
enum BugType {
aphid,
caterpillar,
mite,
ants,
whiteflies,
mealyBug,
thrips,
none
}