Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 2: GPA revisted Create an event-driven version of your gpa.html page that u

ID: 3907042 • Letter: P

Question

Part 2: GPA revisted

Create an event-driven version of your gpa.html page that uses a single text area for inputting the information for all courses. As before, each course should have its name, grade, and credit hours listed on a single line, in that order. When the user clicks on a button, the courses should be read from the text area and the grades processed. Each value output by the program: total credit hours, total grade points, and grade point average, should appear in a separate text box with appropriate text label.

Explanation / Answer

If you have any doubts, please give me comment...

<!DOCTYPE html>

<html>

<head>

<title>Grade Revisited</title>

</head>

<body>

<div>

<p>Enter Text:

<textarea rows=5 cols="50" id="convertText"></textarea>

</p>

<button id="convertTextBtn">Convert</button>

</div>

<p><b>After converted text: </b></p>

<p>Credit Hours: <input type="text" id="creditHours" /></p>

<p>Grade Points: <input type="text" id="gradePoints"/></p>

<p>Grade Points average: <input type="text" id="gpAvg" /></p>

<script type="text/javascript">

var credits = 0;

var gpa = 0;

var n = 0;

document.getElementById("convertTextBtn").onclick=function(){

var line = document.getElementById("convertText").value.split(",");

alert(line.length);

if(line.length==3){

credits += parseInt(line[2]);

gpa += parseInt(line[1]);

n++;

document.getElementById("creditHours").value=credits;

document.getElementById("gradePoints").value=gpa;

document.getElementById("gpAvg").value=(gpa/n).toFixed(2);

}

else{

alert("You must enter name, gpa, credit hours");

}

};

</script>

</body>

</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote