Programming Assignment #4: Calculator

Write a program with the same functionality as a desktop calculator. Your program should print the current display value of the calculator and allow the user to add, subtract, multiply, and divide numbers to/from/by it. For extra credit, you may implement additional functions (sine, cosine, exponential, inversion, squaring, square rooting, inverse trig functions ...) and memories.

Here is an example run:

E-Z Calculator by Seth Li.

DISPLAY: 0.0.  Type +, -, *, /, n for new display, or q to quit.
Option: n
Enter new display value: 3.14159

DISPLAY: 3.14159.  Type +, -, *, /, n for new display, or q to quit.
Option: +
Enter number to add: 9.0210

DISPLAY: 12.16259.  Type +, -, *, /, n for new display, or q to quit.
Option: /
Enter number to divide by:  0
Error!  Division by zero not allowed.  Keeping old display.

DISPLAY: 12.16259.  Type +, -, *, /, n for new display, or q to quit.
Option: q
Adios.