This assignment is not hard, because you will be making simple modifications to a program that takes the same input and produces fully parenthesized prefix notation, as in Lisp. You do not need to know much about java, nor do you need to fully understand the program you are modifying.
Here is the Java program you are to modify.
It converts an arithmetic expression to
fully parenthesized prefix notation (as in Lisp):
pandora% javac Prefix.java
pandora% javac PrefixScan.java
pandora% javac PrefixTest.java
(Actually, just the command javac PrefixTest.java will
force the compiler to compile all three files.)
pandora% java PrefixTest
This invokes the Java Virtual Machine, and puts the class
PrefixTest.class into execution. This class
makes use of the other two classes.
pandora% java PrefixTest
2+3+4+5#
(((2 + 3) + 4) + 5) #
pandora% java PrefixTest
(((2 + 3) + 4) + 5) #
(((2 + 3) + 4) + 5) #
pandora% java PrefixTest
2^3^4^5#
(2 ^ (3 ^ (4 ^ 5))) #
pandora% java PrefixTest
2+3*4^5*6+7#
((2 + ((3 * (4 ^ 5)) * 6)) + 7) #
pandora% java PrefixTest
((3^2-4*1*2)^(1/2)-3)/(2*1)#
(((((3 ^ 2) - ((4 * 1) * 2)) ^ (1 / 2)) - 3) / (2 * 1)) #
pandora%