From 40ad9b2f87d31d73bc78ddb7baf3b746ba0a272d Mon Sep 17 00:00:00 2001 From: Kyle Clemens Date: Sat, 9 Nov 2013 18:17:49 -0500 Subject: Fixed: Make Potato compilable --- src/potato.java | 50 +++++++++++++++++++++++++++++++++++--------------- 1 file 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 condiments = new ArrayList(); + + 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; } } } -- cgit v1.3 From 4043d8a541ba2f92f76c426cfa579fc9cbb3288a Mon Sep 17 00:00:00 2001 From: Kyle Clemens Date: Sat, 9 Nov 2013 18:18:09 -0500 Subject: Renamed: potato.java -> Potato.java --- src/Potato.java | 42 ++++++++++++++++++++++++++++++++++++++++++ src/potato.java | 42 ------------------------------------------ 2 files changed, 42 insertions(+), 42 deletions(-) create mode 100644 src/Potato.java delete mode 100644 src/potato.java 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 condiments = new ArrayList(); + + 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 7f8eb64..0000000 --- a/src/potato.java +++ /dev/null @@ -1,42 +0,0 @@ -import java.util.List; -import java.util.ArrayList; - -public class Potato { - - private final List condiments = new ArrayList(); - - 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; - } - } -} -- cgit v1.3