Implemented Calculator Algorithm