Bläddra i källkod

strange errors on my ridable interface

mpierse 6 år sedan
förälder
incheckning
a6e45e077f

+ 2
- 2
src/main/java/com/zipcodewilmington/froilansfarm/Animals/Egg.java Visa fil

@@ -10,7 +10,7 @@ public class Egg implements Edible, Fertilizable {
10 10
     private boolean isFertilized = false;
11 11
 
12 12
 
13
-    public boolean getisFertilized() {
13
+    public boolean getIsFertilized() {
14 14
         return isFertilized;
15 15
     }
16 16
     public boolean setIsFertilized(boolean rooster) {
@@ -19,7 +19,7 @@ public class Egg implements Edible, Fertilizable {
19 19
     }
20 20
 
21 21
     public boolean isEdible(){
22
-        return !isFertilized();
22
+        return !getIsFertilized();
23 23
     };
24 24
 
25 25
     public void foodIsEaten(int numberEaten){

+ 8
- 8
src/main/java/com/zipcodewilmington/froilansfarm/Animals/Horse.java Visa fil

@@ -19,16 +19,16 @@ public class Horse extends Amimal implements Ridable {
19 19
         return true;
20 20
     }
21 21
 
22
-    public String ride(){
23
-        String result = "";
24
-        if (isRideable() && rider.getIsMounted())
25
-            for (int i=0; i<stable.getHorses(); i++) {
26
-            result += "Horse number " + i + " has been ridden today. \n";
22
+    public String ride() {
23
+        String result = "No riding today";
24
+        if (getIsRideable() && rider.getIsMounted()) {
25
+            result = "";
26
+            for (int i = 0; i < stable.getHorses(); i++) {
27
+                result += "Horse number " + i + " has been ridden today. \n";
28
+            }
27 29
         }
30
+
28 31
         return result;
29 32
     }
30 33
 
31
-
32
-
33
-
34 34
 }

+ 1
- 1
src/main/java/com/zipcodewilmington/froilansfarm/Fertilizable.java Visa fil

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

+ 3
- 0
src/main/java/com/zipcodewilmington/froilansfarm/Holders/CropRow.java Visa fil

@@ -1,4 +1,7 @@
1 1
 package com.zipcodewilmington.froilansfarm.Holders;
2 2
 
3 3
 public class CropRow extends Field {
4
+
5
+
6
+
4 7
 }

+ 3
- 1
src/main/java/com/zipcodewilmington/froilansfarm/Ridable.java Visa fil

@@ -2,7 +2,9 @@ package com.zipcodewilmington.froilansfarm;
2 2
 
3 3
 public interface Ridable {
4 4
 
5
-    boolean isRideable();
5
+    boolean getIsRideable();
6
+
7
+    String ride();
6 8
 
7 9
 
8 10
 

+ 6
- 1
src/main/java/com/zipcodewilmington/froilansfarm/Vehicle/Vehicle.java Visa fil

@@ -9,8 +9,13 @@ public class Vehicle implements Ridable, NoiseMaker {
9 9
         return "VROOM VROOM!";
10 10
     }
11 11
 
12
-    public boolean isRideable(){
12
+    public boolean getIsRideable(){
13 13
         return true;
14 14
     }
15 15
 
16
+    public String ride(){
17
+     return "Moving around on a vehicle";
18
+    };
19
+
20
+
16 21
 }