Question
9-24 More sophisticated computer-assisted instruction systems monitor the students performance over a period of time. The decision to begin a new topic is often based
9-24 More sophisticated computer-assisted instruction systems monitor the students performance over a period of time. The decision to begin a new topic is often based on the students suc- cess with previous topics. Modify the program in Exercise 9.23 to count the number of correct and incorrect responses typed by the student. After the student answers 10 questions, your program should calculate the percentage of correct responses. If the percentage is lower than 75 percent, dis- play Please ask your instructor for extra help, and reset the quiz so another student can try it.
so I already did question 9-23 and this is my code but I cant figure out how to add a counter without breaking my code. I doing this in javascript in an html file.
var number1;
var number2;
// var correct;
// var wrong;
// var counter;
function check()
{
var product = parseInt(document.getElementById("product").value);
if (product == number1 * number2)
{
switch(Math.floor(1+Math.random()*4))
{
case 1:
document.getElementById("product").value = "";
document.getElementById("result").innerHTML = "Very good!";
calculation();
break;
case 2:
document.getElementById("product").value = "";
document.getElementById("result").innerHTML = "Excellent!";
calculation();
break;
case 3: correct = 1;
document.getElementById("product").value = "";
document.getElementById("result").innerHTML = "Nice Work!";
calculation();
break;
case 4 :
document.getElementById("product").value = "";
document.getElementById("result").innerHTML = "Keep up the good work!";
calculation();
break;
default:
document.getElementById("result").innerHTML ="";
}
}
else
{
switch(Math.floor(1+Math.random()*4))
{
case 1:
document.getElementById("product").value = "";
document.getElementById("result").innerHTML = "No. Please try again.";
break;
case 2:
document.getElementById("product").value = "";
document.getElementById("result").innerHTML = "Wrong. Try once more";
break;
case 3:
document.getElementById("product").value = "";
document.getElementById("result").innerHTML = "Don't give up!";
break;
case 4:
document.getElementById("product").value = "";
document.getElementById("result").innerHTML = "No. Keep trying.";
default:
document.getElementById("product").value = "";
document.getElementById("result").innerHTML ="";
}
}
}
function calculation()
{
document.getElementById("controls").style.visibility = 'visible';
number1 = Math.floor((Math.random()*10));
number2 = Math.floor((Math.random()*10));
document.getElementById("question").innerHTML = "How much is " + number1 + " times " + number2 + "?";
document.getElementById("product").focus();
}
function idk()
{
document.getElementById("controls").style.visibility = 'hidden';
calculation();
}
* LEARN MULTIPLICATION *
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started