Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JavaScript Programming Create a Web page named gpa.html that can be used to compute your grade point average given grades and hours for courses completed.

JavaScript Programming

Create a Web page named gpa.html that can be used to compute your grade point average given grades and hours for courses completed. The page should repeatedly prompt the user for course information, reading the course name, grade received, and credit hours for a particular course in a single dialog box. The program should continue prompting and reading in grades until the user enters an empty string to signify the end.

Once the course grades have been stored, the page should compute the student's overall GPA. The grade point averages are computed as follows:

Grade points (a.k.a. quality points) are assigned to each course based on the grade and number of credit hours:

A yields 4 points for each hour

B+ yields 3.5 points for each hour

B yields 3 points for each hour

C+ yields 2.5 points for each hour

C yields 2 points for each hour

D yields 1 point for each hour

F, AF, and WF yield 0 points for each hour

The grade point average (a.k.a. quality point average) is computed by dividing the total number of grade points earned by the total number of credit hours.

For example, suppose a student entered the following course information (with each line entered in a different dialog box):

 THL100 B+ 3
 PHL107 A 3
 ENG120 C+ 3
 MTH245 A 4
 CSC221 A 3

The total number of grade points earned by this student is

 (3.5 * 3) + (4 * 3) + (2.5 * 3) + (4 * 4) + (4 * 3) = 
 10.5 + 12 + 7.5 + 16 + 12 =
 58

Dividing this total by the number of credit hours completed yields a GPA of 58/16 = 3.625.

Your page should display the total number of grade points, number or hours, and GPA, as well as all of the course information in a readable form. This information should not be displayed in the page until all user input has been processed. For example,

COURSE GRADE HOURS
THL100 B+ 3
PHL107 A 3
ENG120 C+ 3
MTH245 A 4
CSC221 A 3
 
Total grade points = 58
Number of hours = 16
GPA = 3.625

Hint: For processing the information on each course, you should utilize the string method split, which splits a string into an array of substrings. For example, line.split(/[\s]/) will return an array of substrings of line, using whitespace (\s) as a delimiter.

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

How would you rate Hsiehs leadership using the Leadership Grid?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago