diff --git a/src/com/company/Apple.java b/src/com/company/Apple.java index 982c9b4..e10e17f 100644 --- a/src/com/company/Apple.java +++ b/src/com/company/Apple.java @@ -1,6 +1,5 @@ package com.company; -import java.time.Duration; import java.util.Date; /** @@ -12,7 +11,7 @@ public class Apple extends Item { private Date bestByDate; public Apple() { - super("apple", "A delicious red apple.", true); + super("Pencil", "An ordinary looking orange pencil", true); birthdate = new Date(); bestByDate = new Date(birthdate.getTime() + 5*60); } diff --git a/src/com/company/Main.java b/src/com/company/Main.java index 9c453eb..e4297e6 100644 --- a/src/com/company/Main.java +++ b/src/com/company/Main.java @@ -1,7 +1,5 @@ package com.company; -import java.util.Scanner; - public class Main { public static void main(String[] args) { @@ -17,7 +15,6 @@ public static void main(String[] args) { // offer help, since this is the player's first time playing String prompt = input.readLine(curRoom.getDescription()+ " Type your command. If you need help, type 'help.'"); - while(true) { String[] words = prompt.split(" "); String directObject = words[words.length-1]; diff --git a/src/com/company/Pencil.java b/src/com/company/Pencil.java new file mode 100644 index 0000000..d4116da --- /dev/null +++ b/src/com/company/Pencil.java @@ -0,0 +1,41 @@ +package com.company; + +public class Pencil extends Item { + + public Pencil () { + super("Pencil", "An ordinary looking orange pencil", false); + } + public Pencil(String name, String description) { + super(name, description, false); + } + + @Override + public String handle(String s) { + if(s.equalsIgnoreCase("examine")) { + return this.getDescription(); + } + else if(s.equalsIgnoreCase("Paint")){ + this.setDescription("The pencil now is yellow."); + return this.getDescription(); + } + else if(s.equalsIgnoreCase("Write")) { + return "The Communist League, an international association of workers, which could of course be only a\n" + + "secret one, under conditions obtaining at the time, commissioned us, the undersigned, at the\n" + + "Congress held in London in November 1847, to write for publication a detailed theoretical and\n" + + "practical programme for the Party. Such was the origin of the following Manifesto, the\n" + + "manuscript of which travelled to London to be printed a few weeks before the February [French]\n" + + "Revolution [in 1848]. First published in German, it has been republished in that language in at\n" + + "least twelve different editions in Germany, England, and America. It was published in English for\n" + + "the first time in 1850 in the Red Republican, London, translated by Miss Helen Macfarlane, and\n" + + "in 1871 in at least three different translations in America. The French version first appeared in\n" + + "Paris shortly before the June insurrection of 1848, and recently in Le Socialiste of New York. A\n" + + "new translation is in the course of preparation. A Polish version appeared in London shortly after\n" + + "it was first published in Germany. A Russian translation was published in Geneva in the sixties1\n" + + ".\n" + + "Into Danish, too, it was translated shortly after its appearance"; + } + else { + return "I don't know how to "+ s + "a pencil"; + } + } +}