diff options
| author | drtshock <drtshock13@gmail.com> | 2013-11-09 15:23:25 -0800 |
|---|---|---|
| committer | drtshock <drtshock13@gmail.com> | 2013-11-09 15:23:25 -0800 |
| commit | a0df812a3882643d330a60144ff29752b70b4b9f (patch) | |
| tree | 80f32d18f60ce3057812c49838f58ff7d3f0117e /src | |
| parent | 16312a9d81c42adc9ac405d37ba4ee9d933a256b (diff) | |
| parent | 4043d8a541ba2f92f76c426cfa579fc9cbb3288a (diff) | |
Merge pull request #7 from jkcclemens/master
Fixed: Make Potato compilable
Diffstat (limited to 'src')
| -rw-r--r-- | src/Potato.java | 42 | ||||
| -rw-r--r-- | src/potato.java | 22 |
2 files changed, 42 insertions, 22 deletions
diff --git a/src/Potato.java b/src/Potato.java new file mode 100644 index 0000000..7f8eb64 --- /dev/null +++ b/src/Potato.java @@ -0,0 +1,42 @@ +import java.util.List; +import java.util.ArrayList; + +public class Potato { + + private final List<Condiment> condiments = new ArrayList<Condiment>(); + + public static void main(String[] args) { + Potato potato = new Potato(); + 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 + } + + private class Condiment { + private final String name; + + public Condiment(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + } +} diff --git a/src/potato.java b/src/potato.java deleted file mode 100644 index 7ee1bb7..0000000 --- a/src/potato.java +++ /dev/null @@ -1,22 +0,0 @@ -public class Potato -{ - - public static void Main(String[] args} - { - Potato potato = new Potato(); - potato.prepare(); - } - - public boolean prepare(Object bob) - { - Potato bob = bob; - bob.addSourCream(); - bob.addChives(); - bob.addButter(); - - if(bob.isDelicous()) - { - return true; - } - } -} |
