Friday, March 5, 2021

 Exercise 3 Grade equivalent


<!DOCTYPE html>

<html>

<head>

<title>Title of the Document</title>

</head>

<style>

body {background-color:maroon;} // styles applied to body tag

</style>


Enter your Full Name <input type="text" placeholder="Type " id="name" Value=" "><br>

Enter your score <input type="text" placeholder="Type " id="score" Value=" "><br>

Enter total numbers of item <input type="text" placeholder="Type " id="total" Value=" ">


<button type="button" onclick="getCompute();">Compute</button>


<script>


function getCompute() {

var name = document.getElementById("name").value;


var score = Number(document.getElementById("score").value);


var total = Number(document.getElementById("total").value);


grade = (score/total);


grade2 = (grade*100) ;



// Displaying the value 


alert("name: " + name +" \n\nscore: " + score +"\n\ntotal " + total + "\n Equivalent grade" +grade2 );

document.write("Name: " + name + "<br> <br> Score: " + score + "<br> <br> Total: " + total + "<br> <br> Equivalent Grade: " + grade2);

}


</script>

</body>

</html>


No comments:

Post a Comment