aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Clemens <jkc.clemens@gmail.com>2013-11-10 02:37:13 -0500
committerKyle Clemens <jkc.clemens@gmail.com>2013-11-10 02:37:13 -0500
commit9d0544e8dc0646e737ea1fde9866a860fef25fe9 (patch)
treee89ca23262fa860504a7450ecc1aaf9953e44c5e
parenta7dbfd20c4192bf0a9e5b52f8dca4b931c7145eb (diff)
Added: Tuber!
Also did some other stuff.
-rw-r--r--src/Potato.java25
-rw-r--r--src/Tuber.java3
2 files changed, 17 insertions, 11 deletions
diff --git a/src/Potato.java b/src/Potato.java
index 51167de..399cdda 100644
--- a/src/Potato.java
+++ b/src/Potato.java
@@ -1,30 +1,29 @@
import java.util.List;
import java.util.ArrayList;
-public class Potato {
+public class Potato implements Tuber {
private final List<Condiment> condiments = new ArrayList<Condiment>();
public static void main(String[] args) {
Potato potato = new Potato();
- Glados glados = new Glados();
+ GLaDOS glados = new GLaDOS();
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?");
+ else System.err.println("Fatal error! How could potato not be delicious?");
}
public boolean prepare() {
- this.addCondiment("sour cream");
- this.addCondiment("chives");
- this.addCondiment("butter");
+ this.addCondiments("sour cream", "chives", "butter");
return this.isDelicious();
}
- public void addCondiment(String name) {
+ public void addCondiments(String... names) {
synchronized (condiments) {
- condiments.add(new Condiment(name));
+ for (String condimentName : names) condiments.add(new Condiment(condimentName));
}
}
+ @Override
public boolean isDelicious() {
return true; // obviously, potatos are always delicious
}
@@ -41,10 +40,14 @@ public class Potato {
}
}
- private static class Glados extends Potato {
- public Glados()
- {
+ private static class GLaDOS extends Potato {
+ public GLaDOS() {
System.out.println("Oh hi, how are you holding up? BECAUSE I'M A POTATO... clap clap clap... oh good, my slow clap processor made it into this thing, at least we have that.");
}
+
+ @Override
+ public boolean isDelicious() {
+ return false; // robots are not delicious
+ }
}
}
diff --git a/src/Tuber.java b/src/Tuber.java
new file mode 100644
index 0000000..ec36f28
--- /dev/null
+++ b/src/Tuber.java
@@ -0,0 +1,3 @@
+public interface Tuber {
+ public boolean isDelicious();
+}