Percentage Discount: Number variable/Numeric Entry has 3 decimal places

Dec 05, 2017

I've created a game which allows the user to work out the discount of items.

For example: 

       £19.99 with a 70% discount.

The student would enter the answers and then I check and see if they are correct.

I've got variables and triggers to work out the percentage discount and then I check this with the students answers in two NumericEntries.

This is what the user will type and want I would expect to be correct.

         Discount = 70% of £19.99 = 13.99

         Price with discount = 19.99 - 13.99 = 6

All types of text round numbers to 2 decimal places, so when I write to the screen it looks correct. However when I compare it, I'm getting an incorrect message.

I wrote the calculations to a NumericEntry to see what is going on and I found that the number variables are returning this:

Discount = 70% of £19.99 = 13.993

Price with discount = 19.99 - 13.99 = 5.997

Therefore when I do a numerical comparison, 13.993 does not equal 13.99 hence the error message.

Why do numeric values have 3 decimal places and text have 2? I can't compare them numerically, but I can't convert them to text.

I'm trying to avoid javascript as it doesn't always work on devices.

Can anyone help with this, it's driving me mad.

3 Replies
Ashley Terwilliger-Pollard

Hi Jane,

Could you look at the user typing their answers into a numeric entry field vs. a standard text entry? That way they'd be able to type/match the decimal places. 

If you're still running into issues with the set up, I'd suggest sharing the .story file here so that folks could take a look at exactly what you have set up! 

This discussion is closed. You can start a new discussion or contact Articulate Support.