CMSC104 Spring 2011

Programming Project 3

GPA Calculator


Out: Friday, April 29, 2011
Due Date: Friday, May 13, 2011 before 11:59 p.m.

The Objective

This project is designed to give you practice writing your own functions in JavaScript.

The Task

This program will allow you to calculate your GPA for one semester. After receiving an explanation of the program and entering the semester, the student will be allowed to enter as many courses as he/she sees fit. The program must then calculate and display the GPA earned for that semester.

In order to produce the GPA, several calculations are needed. For each course, the number of credits, multiplied by the grade points earned in that class, results in a value known as quality points. To calculate the GPA, the total number of quality points for the semester is divided by the total number of credits taken that semester, exclusive of credits for courses taken with the Pass/Fail grading method. Your program should NOT handle Pass/Fail courses at all. The only acceptable grade points are in the range of 0 through 4, where 4 is an A, 3 a B, 2 a C, 1 a D and 0 an F. So, for example, if you took one 3 credit and one 4 credit course and received 2 A's, your GPA for that semester would be:

             3 credits * 4 points = 12 quality points
             4 credits * 4 points = 16 quality points
             28 total quality points / 7 total credits = 4.000 GPA
	

So for each course, you just calculate the quality points for that course and add those points to the total quality points. You should also add the credits to the total credits.

To begin the program, you should print a message to the user explaining what the program does. Then you should ask the user to enter the semester. After these initial steps, you should begin asking the user to enter the name, number of credits and grade for each course, one course at a time. The user should enter "end" as the name of the course to end the input phase. So "end" is the sentinel value for this exercise. At this point a report should be generated that shows the total number of credits taken, the total quality points earned, and the GPA for the semester.

Your program must generate all of the same information as shown in the sample output. You do not need to match the output exactly, however the GPA should be shown to three decimal places. You may also use the data shown here to test your program for accuracy.

More Details

Screenshots

Explanation of program

Getting semester from user

Getting course name from user

Getting number of credits from user

User entering invalid credits

Invalid credits error message

Getting grade from user

Entering sentinel value

Final GPA report

Submitting the Program

You do not have to do anything to submit the program. It should be in your pub/www/cs104/proj3 directory.