EXERCISE : COMPUTING GRADES

 <!DOCTYPE html>

<html>

    <head>

<title> TOTAL OF GRADES<b></title>

</head>


<body>

<b>Enter your name: <input type = "text" placeholder= "type" id="input1" Value=" "><br>

<b>Enter your score: <input type = "text" placeholder= "type" id="input2" Value=" "><br>

<b>Enter the Total number of Items: <input type = "text" placeholder="type" id="input3" Value=" "><br>

<button type= "button" onclick= "next();">compute</button>

<script>

function next(){

var n1 =(document.getElementById("input1").value);

var n2 = Number(document.getElementById("input2").value);

var n3 = Number(document.getElementById("input3").value);

Grade1 =(n2/n3);

Grade2 =(Grade1*100);

alert("name:" + n1 + "\n\ntotal score:" + n2 + "\n\ntotal of items:" + n3 + "\n\nEquivalent Grade:" +Grade2);

document.write("name:" + n1 + "total score:" + n2 + "total of items:" + n3 + "Equivalent Grade:" +Grade2); 

}

</script>

</body>

</html>



Comments