/* Part1Test.java */ /* Performs some simple tests on Expressions containing only +, * and * constants (both integer and string). */ public class Part1Test { static public void main (String [] argv) { // two ways of making integer Values. Expression v9 = new IntValue(9); Expression v6 = Value.make(6); // make some string Values. Expression s1 = Value.make("hello "); Expression s2 = Value.make("world"); Expression E1 = new AddExpr(v9, new MultExpr(v6, v6)); Expression E2 = new AddExpr(s1, s2); Value R1 = E1.eval(); Value R2 = E2.eval(); System.out.println(E1.toString() + " = " + R1.toString()); System.out.println(E2.toString() + " = " + R2.toString()); } }