Tencent interview question

Q: How to code a calculator?