Javascript Calculator Story #13 unfair

Here’s Google calculator: calculator - YouTube
If you input this on a TI-84 its a syntax error.
5 * - + 5 could be interpreted as:

  1. 5 * (-5) = -25
  2. 5 - 5 = 0
  3. 5 + 5 = 10

So I feel like this story is unfair.

the story you are referring to (pasted below for ref)

User Story #13: If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (- ) sign). For example, if 5 + * 7 = is entered, the result should be 35 (i.e. 5 * 7 ); if 5 * - 5 = is entered, the result should be -25 (i.e. 5 * (-5) ).

In a way it is ‘unfair’ if we are judging it on how closely it defines the action of a real calculator. But in this case, it is just a rule to help you work on your coding skills and doesn’t need to make sense in the real world. (You can always fork the code after you’re done and then change this feature to be the way you believe it should work)

1 Like

It’s very unlikely any certification project criteria will change.

In any case, the instructions say this should produce the result 10

If 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign).

1 Like