Grade Equivalent
Date: Feb. 28, 2021
Below is the code used for the second exercise in our Interactive Media Design course subject. I followed the instructions from the previous presentation and added a few modifications required for this exercise.
Below is the code used for the second exercise in our Interactive Media Design course subject. I followed the instructions from the previous presentation and added a few modifications required for this exercise.
<!DOCTYPE html>
<html>
<head>
<title>Grade Equivalent</title>
</head>
<body>
<h1>Grade Equivalent </h1>
<p> <b> Name: </b> <input type="text" id="myText" name="fname" Value=" "> </p>
<p> <b> Score: </b> <input type="text" placeholder="Type " id="inputId2" Value=" "> </p>
<p> <b> Total items: </b> <input type="text" placeholder="Type " id="inputId3" Value=" "> </p> <br>
<button type="button" onclick="getCompute();">Compute</button>
<script>
function getCompute() {
var str = document.getElementById("myText").value;
var n1 = Number(document.getElementById("inputId2").value);
var n2 = Number(document.getElementById("inputId3").value);
ave = ( n1 /n2)*100;
// Displaying the name value sum, dif, pro, quo
alert("Name: " + str + "\nScore: " + n1 + " \nTotal items: " + n2 + " \nAverage: "+ave);
document.write("Grade Equivalent <br> <br> Name: " + str + " <br> <br> Score: " + n1 + " <br> <br> Total items: " + n2 + " <br> <br> Average: " +ave);
}
</script>
</body>
</html>
<html>
<head>
<title>Grade Equivalent</title>
</head>
<body>
<h1>Grade Equivalent </h1>
<p> <b> Name: </b> <input type="text" id="myText" name="fname" Value=" "> </p>
<p> <b> Score: </b> <input type="text" placeholder="Type " id="inputId2" Value=" "> </p>
<p> <b> Total items: </b> <input type="text" placeholder="Type " id="inputId3" Value=" "> </p> <br>
<button type="button" onclick="getCompute();">Compute</button>
<script>
function getCompute() {
var str = document.getElementById("myText").value;
var n1 = Number(document.getElementById("inputId2").value);
var n2 = Number(document.getElementById("inputId3").value);
ave = ( n1 /n2)*100;
// Displaying the name value sum, dif, pro, quo
alert("Name: " + str + "\nScore: " + n1 + " \nTotal items: " + n2 + " \nAverage: "+ave);
document.write("Grade Equivalent <br> <br> Name: " + str + " <br> <br> Score: " + n1 + " <br> <br> Total items: " + n2 + " <br> <br> Average: " +ave);
}
</script>
</body>
</html>
And here are screenshots of the final output shown below after pasting the code on Google: