As usual with these things, there are elements of this project that are not going to be trivially easy for you, but if you’ve been following the course so far, you definitely have everything you need to finish it. We’re going to walk you through the various steps you can take, but again, how you actually implement them is up to you!
eval() function. However, this function can be very dangerous and should not ever be used! You’ll need to build your own functions to evaluate expressions as part of this calculator project.
Here are some use cases (abilities your project needs to have):
operatethat takes an operator and 2 numbers and then calls one of the above functions on the numbers.
operate()on them when the user presses the “=” key.
operate()has been called, update the display with the ‘solution’ to the operation.
12 + 7 - 5 * 3etc. The behavior we’re looking for should be something like this https://www.online-calculator.com/.
=before entering all of the numbers or an operator could cause problems!
.button and let users input decimals! Make sure you don’t let them type more than one though:
188.8.131.52. It is hard to do math on these numbers. (disable the decimal button if there’s already one in the display)