How to check arithmetic expression?

We doing initial work with adding and subtracting integers. I’m trying to verify that the student entered the expression correctly, like 900-400, or -120-400. Verifying the value is easy, but I am stuck on checking the actual expression.
Slide 2

1 Like

Have you tried countNumberUsage?

Does countNumberUsage distinguish between positives and negative values?

I think that if you have the number -4 then it will be counted as a 4, with the negating operation applied to it.

But if you type something like countNumberUsage(this.latex, -4) you will always get zero. (I think, although @Jay might correct me; he was the one who told me originally.)

@Bryn, you’re correct. countNumberUsage only takes positives and can’t distinguish between negatives.

However, @Jeff_Holcomb if you’re also checking the numerical value, it shouldn’t cause a problem.

1 Like

I think we’ve got it-- count usage and value should be OK. We will see what the kids do!

2 Likes