support@topuniversitypapers.com

+1(316)4441378

+44-141-628-6690

simple math game javascript

I need help by programming a small math game with javascript. I already have the structure on my file that I want, but the program is not working yet.

IDEA OF PROJECT
1. question for an addition between 1 and 100 (random numbers)
2. if correct go to subtraction between 1 and 100, if not repeat and stay on this level
3. continuing the structure with multiplication between 1 and 20
4. followed by division between 1 and 20
5. I want 10 questions and then showing a prompt at the end the shows how many points somebody got
6. time restriction of 4 minutes for the 10 questions

using the following structure, but it needs to be continued

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<HTML>
<HEAD>
<TITLE> Project</TITLE>

<SCRIPT LANGUAGE=”JavaScript”>

let Name = prompt(“Hello, What’s your name?”);
console.log(Name);

let a = Math.floor( Math.random() * 100 + 1 );
let b = Math.floor( Math.random() * 100 + 1 );
let a1 = a+b;

let c = Math.floor( Math.random() * 100 + 1 );
let d = Math.floor( Math.random() * 100 + 1 );
let c1 = c-d;

function begin1 (){
  message3.innerHTML = “”;
  a = Math.floor( Math.random() * 100 + 1 );
  b = Math.floor( Math.random() * 100 + 1 );
  a1 = a+b;
  disappear1.innerHTML = “”;
  message1.innerHTML = a + “<br/>” + “+” +”<br/>” + b + “<br/>” + “____________”;
  message2.innerHTML = “<input type = text id= ‘input001’> <button onclick = ‘submit1()’>Submit</Button>”;
  }

function submit1(){
    let answer1 = input001.value;
    show001.innerHTML = answer1;
    if (answer1 == a1) {
      message3.innerHTML = “correct”;
      message2.innerHTML = “”;
      message4.innerHTML = “<button onclick = ‘question2()’>next</button>”;
    }
    else{
      message3.innerHTML = “incorrect”;
      message2.innerHTML = “”;
      message4.innerHTML = “<button onclick = ‘begin1()’>next</button>”;
    }
}

function question2(){
  a = Math.floor( Math.random() * 100 + 1 );
  b = Math.floor( Math.random() * 100 + 1 );
  a1 = a-b;
  message1.innerHTML = c + “<br/>” + “-” +”<br/>” + d + “<br/>” + “____________”;
  message2.innerHTML = “<input type = text id= ‘input002’> <button onclick = ‘submit2()’>Submit</Button>”;
  message3.innerHTML = “”;
  show001.innerHTML = “”;
  }

function submit2(){
    let answer1 = input002.value;
    show001.innerHTML = answer1;
    if (answer1 == a1) {
      message3.innerHTML = “correct”;
      message2.innerHTML = “”;
      message4.innerHTML = “<button onclick = ‘question3()’>next</button>”;
    }
    else{
      message3.innerHTML = “incorrect”;
      message2.innerHTML = “”;
      message4.innerHTML = “<button onclick = ‘begin2()’>next</button>”;
    }
}

</script>

</head>

<BODY>

  <style>
        background-color: lightgrey;
        text-align:center   
  </style>
 
 
  <div id =”frame001″>
    <H1>Mental Arithmetic</H1>
    <p id = “message1”> </p>
    <p id = “message2”> </p>
    <p id = “show001”> </p>
    <p id = “message3”> </p>
    <p id = “message4”> </p>

    <div id = “disappear1”>
        <button onclick = “begin1()” >Begin</button>
    </div>

</body>
</html>

 

You can place an order similar to this with us. You are assured of an authentic custom paper delivered within the given deadline besides our 24/7 customer support all through.

 

Latest completed orders:

# topic title discipline academic level pages delivered
6
Writer's choice
Business
University
2
1 hour 32 min
7
Wise Approach to
Philosophy
College
2
2 hours 19 min
8
1980's and 1990
History
College
3
2 hours 20 min
9
pick the best topic
Finance
School
2
2 hours 27 min
10
finance for leisure
Finance
University
12
2 hours 36 min
[order_calculator]