Implemented the problem 2 calculator.