Sfoglia il codice sorgente

added methods up to farm vehicle

mpierse 6 anni fa
parent
commit
61f5aa9f68
46 ha cambiato i file con 262 aggiunte e 43 eliminazioni
  1. 0
    6
      src/main/java/com/zipcodewilmington/froilansfarm/Aircraft.java
  2. 19
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Animals/Amimal.java
  3. 16
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Animals/Chicken.java
  4. 26
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Animals/Egg.java
  5. 7
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Animals/Hen.java
  6. 16
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Animals/Horse.java
  7. 7
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Animals/Rooster.java
  8. 0
    4
      src/main/java/com/zipcodewilmington/froilansfarm/Chicken.java
  9. 0
    4
      src/main/java/com/zipcodewilmington/froilansfarm/ChickenCoop.java
  10. 0
    6
      src/main/java/com/zipcodewilmington/froilansfarm/CropDuster.java
  11. 8
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Eater.java
  12. 9
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Edible.java
  13. 3
    1
      src/main/java/com/zipcodewilmington/froilansfarm/Farmer.java
  14. 7
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Fertilizable.java
  15. 1
    1
      src/main/java/com/zipcodewilmington/froilansfarm/Fertilizer.java
  16. 4
    1
      src/main/java/com/zipcodewilmington/froilansfarm/Harvests.java
  17. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Holders/Barn.java
  18. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Holders/ChickenCoop.java
  19. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Holders/CropRow.java
  20. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Holders/Farm.java
  21. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Holders/FarmHouse.java
  22. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Holders/Field.java
  23. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Holders/Stable.java
  24. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Holders/Storer.java
  25. 0
    4
      src/main/java/com/zipcodewilmington/froilansfarm/Horse.java
  26. 6
    0
      src/main/java/com/zipcodewilmington/froilansfarm/NoiseMaker.java
  27. 2
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Person.java
  28. 3
    1
      src/main/java/com/zipcodewilmington/froilansfarm/Pilot.java
  29. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/Botanist.java
  30. 6
    0
      src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/CornEar.java
  31. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/CornStalk.java
  32. 7
    0
      src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/Crop.java
  33. 6
    0
      src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/Tomato.java
  34. 6
    0
      src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/TomatoPlant.java
  35. 1
    1
      src/main/java/com/zipcodewilmington/froilansfarm/Produce.java
  36. 7
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Ridable.java
  37. 0
    4
      src/main/java/com/zipcodewilmington/froilansfarm/Stable.java
  38. 0
    6
      src/main/java/com/zipcodewilmington/froilansfarm/Tractor.java
  39. 0
    4
      src/main/java/com/zipcodewilmington/froilansfarm/Vehicle.java
  40. 6
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Aircraft.java
  41. 7
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/CropDuster.java
  42. 5
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/FarmVehicle.java
  43. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Flyable.java
  44. 4
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Flyer.java
  45. 13
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Tractor.java
  46. 16
    0
      src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Vehicle.java

+ 0
- 6
src/main/java/com/zipcodewilmington/froilansfarm/Aircraft.java Vedi File

@@ -1,6 +0,0 @@
1
-package com.zipcodewilmington.froilansfarm;
2
-
3
-import com.zipcodewilmington.froilansfarm.Vehicle;
4
-
5
-public class Aircraft extends Vehicle {
6
-}

+ 19
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Animals/Amimal.java Vedi File

@@ -0,0 +1,19 @@
1
+package com.zipcodewilmington.froilansfarm.Animals;
2
+
3
+import com.zipcodewilmington.froilansfarm.Eater;
4
+import com.zipcodewilmington.froilansfarm.Edible;
5
+import com.zipcodewilmington.froilansfarm.NoiseMaker;
6
+
7
+public class Amimal implements NoiseMaker, Eater {
8
+
9
+
10
+    public String makeNoise(){
11
+        return "LOUD NOISE!";
12
+    }
13
+
14
+    public void eat(Edible food, int numberEaten) {
15
+        if (food.isEdible()) {
16
+            food.foodIsEaten(numberEaten);
17
+        }
18
+    }
19
+}

+ 16
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Animals/Chicken.java Vedi File

@@ -0,0 +1,16 @@
1
+package com.zipcodewilmington.froilansfarm.Animals;
2
+
3
+import com.zipcodewilmington.froilansfarm.Animals.Amimal;
4
+import com.zipcodewilmington.froilansfarm.Edible;
5
+
6
+public class Chicken extends Amimal {
7
+
8
+    public String makeNoise(){
9
+        return "CLUCK CLUCK!!";
10
+    }
11
+
12
+    @Override
13
+    public void eat(Edible food, int numberEaten){
14
+        super.eat(food, numberEaten);
15
+    }
16
+}

+ 26
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Animals/Egg.java Vedi File

@@ -0,0 +1,26 @@
1
+package com.zipcodewilmington.froilansfarm.Animals;
2
+
3
+import com.zipcodewilmington.froilansfarm.Edible;
4
+import com.zipcodewilmington.froilansfarm.Fertilizable;
5
+
6
+public class Egg implements Edible, Fertilizable {
7
+
8
+    private int eggCount = 0;
9
+
10
+    public boolean isFertilized() {
11
+        //if no roosters in chicken coop that yeilds egg
12
+        return false;
13
+    }
14
+
15
+    public boolean isEdible(){
16
+        return !isFertilized();
17
+    };
18
+
19
+    public void foodIsEaten(int numberEaten){
20
+        eggCount -= numberEaten;
21
+    };
22
+
23
+    public void foodIsAdded(int foodAdded){
24
+        eggCount += foodAdded;
25
+    }
26
+}

+ 7
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Animals/Hen.java Vedi File

@@ -0,0 +1,7 @@
1
+package com.zipcodewilmington.froilansfarm.Animals;
2
+
3
+import com.zipcodewilmington.froilansfarm.Animals.Chicken;
4
+import com.zipcodewilmington.froilansfarm.Produce;
5
+
6
+public class Hen extends Chicken implements Produce {
7
+}

+ 16
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Animals/Horse.java Vedi File

@@ -0,0 +1,16 @@
1
+package com.zipcodewilmington.froilansfarm.Animals;
2
+
3
+import com.zipcodewilmington.froilansfarm.Animals.Amimal;
4
+import com.zipcodewilmington.froilansfarm.Ridable;
5
+
6
+public class Horse extends Amimal implements Ridable {
7
+
8
+    public String makeNoise() {
9
+        return "NEIGH!";
10
+    }
11
+
12
+    public void eat() {
13
+
14
+    }
15
+
16
+}

+ 7
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Animals/Rooster.java Vedi File

@@ -0,0 +1,7 @@
1
+package com.zipcodewilmington.froilansfarm.Animals;
2
+
3
+import com.zipcodewilmington.froilansfarm.Animals.Chicken;
4
+import com.zipcodewilmington.froilansfarm.Fertilizer;
5
+
6
+public class Rooster extends Chicken implements Fertilizer {
7
+}

+ 0
- 4
src/main/java/com/zipcodewilmington/froilansfarm/Chicken.java Vedi File

@@ -1,4 +0,0 @@
1
-package com.zipcodewilmington.froilansfarm;
2
-
3
-public class Chicken extends Amimal {
4
-}

+ 0
- 4
src/main/java/com/zipcodewilmington/froilansfarm/ChickenCoop.java Vedi File

@@ -1,4 +0,0 @@
1
-package com.zipcodewilmington.froilansfarm;
2
-
3
-public class ChickenCoop {
4
-}

+ 0
- 6
src/main/java/com/zipcodewilmington/froilansfarm/CropDuster.java Vedi File

@@ -1,6 +0,0 @@
1
-package com.zipcodewilmington.froilansfarm;
2
-
3
-import Aircraft;
4
-
5
-public class CropDuster extends Aircraft {
6
-}

+ 8
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Eater.java Vedi File

@@ -0,0 +1,8 @@
1
+package com.zipcodewilmington.froilansfarm;
2
+
3
+public interface Eater {
4
+
5
+    public void eat(Edible food, int numberEaten);
6
+
7
+}
8
+

+ 9
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Edible.java Vedi File

@@ -0,0 +1,9 @@
1
+package com.zipcodewilmington.froilansfarm;
2
+
3
+public interface Edible {
4
+    public boolean isEdible();
5
+
6
+    public void foodIsEaten(int numberEaten);
7
+
8
+    public void foodIsAdded(int foodAdded);
9
+}

+ 3
- 1
src/main/java/com/zipcodewilmington/froilansfarm/Farmer.java Vedi File

@@ -1,4 +1,6 @@
1 1
 package com.zipcodewilmington.froilansfarm;
2 2
 
3
-public class Farmer extends Person {
3
+import com.zipcodewilmington.froilansfarm.PlantsAndCrops.Botanist;
4
+
5
+public class Farmer extends Person implements Harvests, Botanist {
4 6
 }

+ 7
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Fertilizable.java Vedi File

@@ -0,0 +1,7 @@
1
+package com.zipcodewilmington.froilansfarm;
2
+
3
+public interface Fertilizable {
4
+
5
+    boolean isFertilized();
6
+
7
+}

src/main/java/com/zipcodewilmington/froilansfarm/Amimal.java → src/main/java/com/zipcodewilmington/froilansfarm/Fertilizer.java Vedi File

@@ -1,4 +1,4 @@
1 1
 package com.zipcodewilmington.froilansfarm;
2 2
 
3
-public class Amimal {
3
+public interface Fertilizer {
4 4
 }

src/main/java/com/zipcodewilmington/froilansfarm/FarmHouse.java → src/main/java/com/zipcodewilmington/froilansfarm/Harvests.java Vedi File

@@ -1,4 +1,7 @@
1 1
 package com.zipcodewilmington.froilansfarm;
2 2
 
3
-public class FarmHouse {
3
+public interface Harvests {
4
+
5
+    
6
+
4 7
 }

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/Barn.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Holders;
2
+
3
+public class Barn implements Storer {
4
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/ChickenCoop.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Holders;
2
+
3
+public class ChickenCoop implements Storer {
4
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/CropRow.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Holders;
2
+
3
+public class CropRow implements Storer {
4
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/Farm.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Holders;
2
+
3
+public class Farm implements Storer {
4
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/FarmHouse.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Holders;
2
+
3
+public class FarmHouse implements Storer {
4
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/Field.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Holders;
2
+
3
+public class Field implements Storer {
4
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/Stable.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Holders;
2
+
3
+public class Stable implements Storer {
4
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/Storer.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Holders;
2
+
3
+public interface Storer {
4
+}

+ 0
- 4
src/main/java/com/zipcodewilmington/froilansfarm/Horse.java Vedi File

@@ -1,4 +0,0 @@
1
-package com.zipcodewilmington.froilansfarm;
2
-
3
-public class Horse extends Amimal {
4
-}

+ 6
- 0
src/main/java/com/zipcodewilmington/froilansfarm/NoiseMaker.java Vedi File

@@ -0,0 +1,6 @@
1
+package com.zipcodewilmington.froilansfarm;
2
+
3
+public interface NoiseMaker {
4
+
5
+    public String makeNoise();
6
+}

+ 2
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Person.java Vedi File

@@ -1,4 +1,6 @@
1 1
 package com.zipcodewilmington.froilansfarm;
2 2
 
3
+import com.zipcodewilmington.froilansfarm.Animals.Amimal;
4
+
3 5
 public class Person extends Amimal {
4 6
 }

+ 3
- 1
src/main/java/com/zipcodewilmington/froilansfarm/Pilot.java Vedi File

@@ -1,4 +1,6 @@
1 1
 package com.zipcodewilmington.froilansfarm;
2 2
 
3
-public class Pilot extends Person {
3
+import com.zipcodewilmington.froilansfarm.Vehicle.Flyer;
4
+
5
+public class Pilot extends Person implements Flyer {
4 6
 }

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/Botanist.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.PlantsAndCrops;
2
+
3
+public interface Botanist {
4
+}

+ 6
- 0
src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/CornEar.java Vedi File

@@ -0,0 +1,6 @@
1
+package com.zipcodewilmington.froilansfarm.PlantsAndCrops;
2
+
3
+import com.zipcodewilmington.froilansfarm.Edible;
4
+
5
+public class CornEar implements Edible {
6
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/CornStalk.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.PlantsAndCrops;
2
+
3
+public class CornStalk extends Crop {
4
+}

+ 7
- 0
src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/Crop.java Vedi File

@@ -0,0 +1,7 @@
1
+package com.zipcodewilmington.froilansfarm.PlantsAndCrops;
2
+
3
+import com.zipcodewilmington.froilansfarm.Fertilizable;
4
+import com.zipcodewilmington.froilansfarm.Produce;
5
+
6
+public class Crop implements Produce, Fertilizable {
7
+}

+ 6
- 0
src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/Tomato.java Vedi File

@@ -0,0 +1,6 @@
1
+package com.zipcodewilmington.froilansfarm.PlantsAndCrops;
2
+
3
+import com.zipcodewilmington.froilansfarm.Edible;
4
+
5
+public class Tomato implements Edible {
6
+}

+ 6
- 0
src/main/java/com/zipcodewilmington/froilansfarm/PlantsAndCrops/TomatoPlant.java Vedi File

@@ -0,0 +1,6 @@
1
+package com.zipcodewilmington.froilansfarm.PlantsAndCrops;
2
+
3
+import com.zipcodewilmington.froilansfarm.PlantsAndCrops.Crop;
4
+
5
+public class TomatoPlant extends Crop {
6
+}

src/main/java/com/zipcodewilmington/froilansfarm/Farm.java → src/main/java/com/zipcodewilmington/froilansfarm/Produce.java Vedi File

@@ -1,4 +1,4 @@
1 1
 package com.zipcodewilmington.froilansfarm;
2 2
 
3
-public class Farm {
3
+public interface Produce {
4 4
 }

+ 7
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Ridable.java Vedi File

@@ -0,0 +1,7 @@
1
+package com.zipcodewilmington.froilansfarm;
2
+
3
+public interface Ridable {
4
+
5
+    boolean isRideable();
6
+
7
+}

+ 0
- 4
src/main/java/com/zipcodewilmington/froilansfarm/Stable.java Vedi File

@@ -1,4 +0,0 @@
1
-package com.zipcodewilmington.froilansfarm;
2
-
3
-public class Stable {
4
-}

+ 0
- 6
src/main/java/com/zipcodewilmington/froilansfarm/Tractor.java Vedi File

@@ -1,6 +0,0 @@
1
-package com.zipcodewilmington.froilansfarm;
2
-
3
-import com.zipcodewilmington.froilansfarm.Vehicle;
4
-
5
-public class Tractor extends Vehicle {
6
-}

+ 0
- 4
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle.java Vedi File

@@ -1,4 +0,0 @@
1
-package com.zipcodewilmington.froilansfarm;
2
-
3
-public class Vehicle {
4
-}

+ 6
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Aircraft.java Vedi File

@@ -0,0 +1,6 @@
1
+package com.zipcodewilmington.froilansfarm.Vehicle;
2
+
3
+import com.zipcodewilmington.froilansfarm.Vehicle.Vehicle;
4
+
5
+public class Aircraft extends Vehicle {
6
+}

+ 7
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/CropDuster.java Vedi File

@@ -0,0 +1,7 @@
1
+package com.zipcodewilmington.froilansfarm.Vehicle;
2
+
3
+
4
+import com.zipcodewilmington.froilansfarm.Fertilizer;
5
+
6
+public class CropDuster extends Aircraft implements FarmVehicle, Fertilizer, Flyable {
7
+}

+ 5
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/FarmVehicle.java Vedi File

@@ -0,0 +1,5 @@
1
+package com.zipcodewilmington.froilansfarm.Vehicle;
2
+
3
+public interface FarmVehicle {
4
+    boolean isOnAFarm();
5
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Flyable.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Vehicle;
2
+
3
+public interface Flyable {
4
+}

+ 4
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Flyer.java Vedi File

@@ -0,0 +1,4 @@
1
+package com.zipcodewilmington.froilansfarm.Vehicle;
2
+
3
+public interface Flyer {
4
+}

+ 13
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Tractor.java Vedi File

@@ -0,0 +1,13 @@
1
+package com.zipcodewilmington.froilansfarm.Vehicle;
2
+
3
+import com.zipcodewilmington.froilansfarm.Harvests;
4
+
5
+public class Tractor extends Vehicle implements Harvests, FarmVehicle {
6
+
7
+    public boolean isOnAFarm(){
8
+        return true;
9
+    }
10
+
11
+
12
+
13
+}

+ 16
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Vehicle.java Vedi File

@@ -0,0 +1,16 @@
1
+package com.zipcodewilmington.froilansfarm.Vehicle;
2
+
3
+import com.zipcodewilmington.froilansfarm.NoiseMaker;
4
+import com.zipcodewilmington.froilansfarm.Ridable;
5
+
6
+public class Vehicle implements Ridable, NoiseMaker {
7
+
8
+    public String makeNoise(){
9
+        return "VROOM VROOM!";
10
+    }
11
+
12
+    public boolean isRideable(){
13
+        return true;
14
+    }
15
+
16
+}