Merge pull request #7 from jkcclemens/master
Fixed: Make Potato compilable
This commit is contained in:
commit
a0df812a38
2 changed files with 42 additions and 22 deletions
42
src/Potato.java
Normal file
42
src/Potato.java
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue