Nathan Hall 5 anni fa
parent
commit
4de0e3efe9

+ 10
- 1
src/main/java/rocks/zipcode/quiz5/collections/Food.java Vedi File

@@ -2,6 +2,7 @@ package rocks.zipcode.quiz5.collections;
2 2
 
3 3
 import rocks.zipcode.quiz5.objectorientation.Spice;
4 4
 
5
+import java.util.ArrayList;
5 6
 import java.util.List;
6 7
 import java.util.Map;
7 8
 
@@ -9,8 +10,15 @@ import java.util.Map;
9 10
  * @author leon on 27/12/2018.
10 11
  */
11 12
 public class Food {
13
+    private ArrayList<Spice> spices = new ArrayList<>();
14
+    private Spice spice;
15
+
12 16
     public List<Spice> getAllSpices() {
13
-        return null;
17
+        for (Spice sp : spices){
18
+            spices.add(sp);
19
+        }
20
+
21
+        return spices;
14 22
     }
15 23
 
16 24
     public <SpiceType extends Class<? extends Spice>> Map<SpiceType, Integer> getSpiceCount() {
@@ -18,5 +26,6 @@ public class Food {
18 26
     }
19 27
 
20 28
     public void applySpice(Spice spice) {
29
+        this.spice = spice;
21 30
     }
22 31
 }

+ 1
- 1
src/main/java/rocks/zipcode/quiz5/objectorientation/Curry.java Vedi File

@@ -1,4 +1,4 @@
1 1
 package rocks.zipcode.quiz5.objectorientation;
2 2
 
3
-public class Curry {
3
+public class Curry implements Spice {
4 4
 }

+ 1
- 1
src/main/java/rocks/zipcode/quiz5/objectorientation/Ginger.java Vedi File

@@ -3,5 +3,5 @@ package rocks.zipcode.quiz5.objectorientation;
3 3
 /**
4 4
  * @author leon on 27/12/2018.
5 5
  */
6
-public class Ginger {
6
+public class Ginger implements Spice{
7 7
 }

+ 1
- 1
src/main/java/rocks/zipcode/quiz5/objectorientation/Pepper.java Vedi File

@@ -3,5 +3,5 @@ package rocks.zipcode.quiz5.objectorientation;
3 3
 /**
4 4
  * @author leon on 27/12/2018.
5 5
  */
6
-public class Pepper {
6
+public class Pepper implements Spice{
7 7
 }

+ 5
- 1
src/main/java/rocks/zipcode/quiz5/objectorientation/account/Account.java Vedi File

@@ -4,10 +4,14 @@ package rocks.zipcode.quiz5.objectorientation.account;
4 4
  * @author leon on 30/12/2018.
5 5
  */
6 6
 public class Account extends BankAccount {
7
+
8
+    private Long id;
9
+
7 10
     public Long getId() {
8
-        return null;
11
+        return id;
9 12
     }
10 13
 
11 14
     public void setId(Long id) {
15
+        this.id = id;
12 16
     }
13 17
 }

+ 1
- 0
src/main/java/rocks/zipcode/quiz5/objectorientation/account/BankAccount.java Vedi File

@@ -5,5 +5,6 @@ package rocks.zipcode.quiz5.objectorientation.account;
5 5
  */
6 6
 public class BankAccount {
7 7
     public void setBalance(Double val) {
8
+
8 9
     }
9 10
 }