Electronic Calculator

Electronic Calculator
0

So it seems forever since I completed this project, but something recently reminded me of it and I wanted to get your thoughts. This is my original project…I wanted to make a scientific calculator, so naturally I had an input portion of the screen and an output portion of the screen, only to realize that the tests didn’t really like that and just wanted one thing display on the screen, so I dumbed it down a little to pass the tests, and I wanted to get your guys’ opinion on it (on both versions).

It looks good. One suggestion is to sanitize the output so if the user forgets to close the parentheses or accidentally adds an additional operation symbol that the output won’t become undefined and still calculates.

1 Like

@nohjlau thank you for the input ^^ I was considering doing that, and some physical calculators do that, such as the TI-83, but others (such as the TI-95) don’t support that. My view is that this is user error, and not a failing of the calculator itself, and can result in misleading conclusions. For example, if I put in e^(2*pi+1 and leave out the close parentheses, and the algorithm automatically fills it in, it will most likely fill it in at the end…i.e., the output would be the result of the expression e^(2*pi+1) and if the user actually meant to put in e^(2*pi)+1 rather than getting an error that something is wrong, the user is getting back a misleading answer. If I was inclined, I could make the errors more descriptive than just (‘undefined’)