aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Clemens <jkc.clemens@gmail.com>2013-11-09 18:17:49 -0500
committerKyle Clemens <jkc.clemens@gmail.com>2013-11-09 18:17:49 -0500
commit40ad9b2f87d31d73bc78ddb7baf3b746ba0a272d (patch)
tree614f6bba151c051d0117735db645a0384ca099a2
parent16312a9d81c42adc9ac405d37ba4ee9d933a256b (diff)
Fixed: Make Potato compilable
-rw-r--r--src/potato.java50
1 files changed, 35 insertions, 15 deletions
diff --git a/src/potato.java b/src/potato.java
index 7ee1bb7..7f8eb64 100644
--- a/src/potato.java
+++ b/src/potato.java
@@ -1,22 +1,42 @@
-public class Potato
-{
+import java.util.List;
+import java.util.ArrayList;
- public static void Main(String[] args}
- {
+public class Potato {
+
+ private final List<Condiment> condiments = new ArrayList<Condiment>();
+
+ public static void main(String[] args) {
Potato potato = new Potato();
- potato.prepare();
+ if (potato.prepare()) System.out.println("Of course potato is prepared and delicious.");
+ else System.out.println("Fatal error! How could potato not be delicious?");
+ }
+
+ public boolean prepare() {
+ this.addCondiment("sour cream");
+ this.addCondiment("chives");
+ this.addCondiment("butter");
+ return this.isDelicious();
+ }
+
+ public void addCondiment(String name) {
+ synchronized (condiments) {
+ condiments.add(new Condiment(name));
+ }
+ }
+
+ public boolean isDelicious() {
+ return true; // obviously, potatos are always delicious
}
- public boolean prepare(Object bob)
- {
- Potato bob = bob;
- bob.addSourCream();
- bob.addChives();
- bob.addButter();
-
- if(bob.isDelicous())
- {
- return true;
+ private class Condiment {
+ private final String name;
+
+ public Condiment(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
}
}
}