Week 4 Assignment Part 2: A While Loop for Practicing Arithmetic Calculations
The program is designed to do the following:
There are two JavaScript functions used in this program:
The first function returns a random number between zero and one, such as 0.9756070656669248 or 0.4477332493847449.
In the example, we multiply the random number by 100 to fit our needs, getting 97.56070656669247 or 44.77332493847449.
The second function rounds a number to its nearest integer:
Math.round(97.56070656669247)
returns 98.
Math.round(44.77332493847449)
returns 45.
To see a demo of the above functions, visit http://courses.dsu.edu/cet756/lessons/JavaScript/functions/mathrandom_and_mathround.htm
The Task:
Right now, the program has a bug that prevents it from determining correct answers and giving the right feedback. It'll say "Correct!" even when the user input is incorrect. Consequently, it cannot get the correct number of correct answers (sorry about the double use of "correct") when the user quits. Your task is to find and fix this bug.
This bug is somewhat subtle and may not be easily identified through a debugger. Please view the source code of the page carefully and see if you can find it. When you find the bug, write down what the problem is, and how it can be fixed.