Calculator implemented in Java