Create a simple class in Java that is located in the
package:
edu.uchicago.cs.Homework1
The class should be named
MyClass.
The class should prompt for input in the form of a numeric
expression (taking precisely two operands), and should tokenize the text
entered, and should then print out the result of the calculation.
For
example, if the following text is input:
2 + 2
The result
displayed would be:
4
You may use if statements or case statements
to implement the actual calculation engine. You do not need to handle any
operators other than (+, -, x, /) (addition, subtraction, multiplication,
division). You do NOT need to handle parentheses or compound
statements.
You SHOULD, however, instantiate and instance of an
appropriate java.lang.* class to handle each number input. For example,
you should instantiate the following classes in the case of the the following
input:
2: instantiate an Integer
class
2.2: instantiate a Double class
Then,
you should perform the operation on the two numbers and print the
result.