Commit 1159c719 authored by Charlie Graham Carr's avatar Charlie Graham Carr

Removed code that broke it

parent 0f2f349c
No preview for this file type
import java.lang.Exception; import java.lang.Exception;
import java.io.*; import java.io.*;
import java.util.*;
public class Start public class Start
{ {
...@@ -29,11 +30,29 @@ public static void main(String[] args) ...@@ -29,11 +30,29 @@ public static void main(String[] args)
} }
} }
static private HashMap<String, String> variables = new HashMap<String, String>();
/** Process a single line of the input program. /** Process a single line of the input program.
* @param line Line to process. * @param line Line to process.
*/ */
private static void process(String line) private static void process(String line)
{ {
System.out.println("Line: " + line); String[] bits = line.split(" ");
if (bits.length == 5 && bits[0].equals("that") && bits[2].equals("looks") && bits[3].equals("about")) {
// might be a set variable commmand
variables.put(bits[1], bits[4]);
} else if (bits.length == 4 && bits[0].equals("what") && bits[1].equals("was") && bits[3].equals("again?")) {
System.out.println(variables.get(bits[2]));
}
public static void process(String line)
{
String[] bits = line.split(" ");
if (bits.length == 5 && bits[0]equals("that") && bits[2].equals("is") && bits[3].equals("now")){
variables.put(bits[1], bits[4]);
}
}
}
} }
} }
that x looks about 6
what was x again?
that y is now 10
what was y?
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment