Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/com/company/Apple.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.company;

import java.time.Duration;
import java.util.Date;

/**
Expand All @@ -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);
}
Expand Down
3 changes: 0 additions & 3 deletions src/com/company/Main.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.company;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
Expand All @@ -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];
Expand Down
41 changes: 41 additions & 0 deletions src/com/company/Pencil.java
Original file line number Diff line number Diff line change
@@ -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";
}
}
}