diff options
-rw-r--r-- | src/esieequest/CommandWords.java | 7 | ||||
-rw-r--r-- | src/esieequest/Game.java | 2 | ||||
-rw-r--r-- | src/esieequest/Parser.java | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/src/esieequest/CommandWords.java b/src/esieequest/CommandWords.java index a0718e3..c942043 100644 --- a/src/esieequest/CommandWords.java +++ b/src/esieequest/CommandWords.java | |||
@@ -35,10 +35,11 @@ public class CommandWords { | |||
35 | /** | 35 | /** |
36 | * Print all valid commands to System.out. | 36 | * Print all valid commands to System.out. |
37 | */ | 37 | */ |
38 | public void showAll() { | 38 | public String getCommandList() { |
39 | String vCommands = ""; | ||
39 | for (String vCommand : this.sValidCommands) { | 40 | for (String vCommand : this.sValidCommands) { |
40 | System.out.print(vCommand + " "); | 41 | vCommands += " " + vCommand; |
41 | } | 42 | } |
42 | System.out.println(); | 43 | return vCommands; |
43 | } | 44 | } |
44 | } | 45 | } |
diff --git a/src/esieequest/Game.java b/src/esieequest/Game.java index 165724a..cae7559 100644 --- a/src/esieequest/Game.java +++ b/src/esieequest/Game.java | |||
@@ -215,7 +215,7 @@ public class Game { | |||
215 | System.out.println("You wander around at the university."); | 215 | System.out.println("You wander around at the university."); |
216 | System.out.println(""); | 216 | System.out.println(""); |
217 | System.out.println("Your command words are:"); | 217 | System.out.println("Your command words are:"); |
218 | this.aParser.showCommands(); | 218 | System.out.println(this.aParser.showCommands()); |
219 | } | 219 | } |
220 | 220 | ||
221 | private void look() { | 221 | private void look() { |
diff --git a/src/esieequest/Parser.java b/src/esieequest/Parser.java index b8f5c94..d270f1e 100644 --- a/src/esieequest/Parser.java +++ b/src/esieequest/Parser.java | |||
@@ -59,7 +59,7 @@ public class Parser { | |||
59 | /** | 59 | /** |
60 | * Print out a list of valid command words. | 60 | * Print out a list of valid command words. |
61 | */ | 61 | */ |
62 | public void showCommands() { | 62 | public String showCommands() { |
63 | this.aValidCommands.showAll(); | 63 | return this.aValidCommands.getCommandList(); |
64 | } | 64 | } |
65 | } | 65 | } |