xhtml
 

Exercise 14: Calculator

This exercise is about building a mini calculator program. The program is supposed to take two numbers with an operator in between and do the requested sum. The program tests the operator against each of the standard ones +, -, *, or /.

In case the operating system treats any of the operators as special characters, the operator will need to have quotes round it, e.g. java Calculator 3 "+" 4 but the quotes will be taken off by the operating system before the arguments reach your program, so the program itself does not need to take account of the quotes.


Back