Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

gpa.html code function load() { var data = []; while (true) { var line = prompt(Enter course name, grade, and credit hours (e.g. CS320 B+

image text in transcribed

gpa.html code

function load() {

var data = [];

while (true) {

var line = prompt("Enter course name, grade, and credit hours (e.g. CS320 B+ 4) ");

if (line == null || line == "") {

break;

}

var values = line.split(/\s/);

data.push(values);

}

return data;

}

function display(data) {

var points = {

"A": 4,

"B+": 3.5,

"B": 3,

"C+": 2.5,

"C": 2,

"D": 1,

"F": 0,

"AF": 0,

"WF": 0

};

var hours = 0;

var table = document.getElementById('result');

table.innerHTML = "

CourseGradeHours";

var sum = 0;

for (var i in data) {

var item = data[i];

table.innerHTML += "

" +

item[0] + "

" +

item[1] + "

" + item[2] + "";

sum += points[item[1]] * parseInt(item[2]);

hours += parseInt(item[2]);

}

var gpa = sum / hours;

var text = "
Total grade points = " + sum;

text += "
Number of hours = " + hours + "
";

text += "GPA = " + gpa; //printing the output

document.getElementById('text').innerHTML = text;

}

data = load();

display(data);

Part 2: GPA Revisited 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. You are making a GUI version of the program you wrote in assignment 1. 2 GPA Calculator - Internet Explorer Provided b... Submit both part Fie Tools Help Edt View Favontes Bar Search Address : Documents and Settings\Administrate GO Links GPA Calculator THL100 B+ 3 PHL107 A 3 ENG120 C+ 3 MTH245A CSC221 3 Compute GPA Total # of grade points: 58 Total # of credit hours: 16 Grade Point Average: 3.625 Donc My Computer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions

Question

1. Prepare a flowchart of Dr. Mahalees service encounters.

Answered: 1 week ago