Java implementation - scientific calculator