GPA CALCULATOR - Suraj @ LUMS by mm6889


gpa calculator

More Info
									Lab Week 6: Section 1
The goal of this lab to make a calculator application which will help LUMS students compute their GPA.
This lab is divided into two types of tasks: basic and advanced. Completing the basic task properly is worth
70% of the grade. Completing the advanced tasks is worth 30% of the grade.

A sample application which implements both basic and advanced tasks is given in the lab folder, and is
named GPA.exe. Its screen shot is shown below.


When the user first runs the application, Course # 1 is displayed next to the two text
boxes, and the result values inside the black-outlined box are all blank, as shown in
the figure on the right. The user now enters the units and grade of the first course in
the text boxes. Then she hits the button marked “Add Course”. Information on this
course is now added to the results box, which means that “Total Courses” are
increased by 1, “Total Units” are increased by the units of this course, and the “Your
GPA” result is updated to be the current GPA of the student. At the same time, the
data in the text boxes is cleared, and the application becomes ready to accept another
course by changing the caption of the top label to “Course # 2”. As the user enters
more and more courses, the results box, containing “Total Courses”, Total Units” and
“Your GPA” is kept updated. If the user hits the clear button, the entire data on
courses is cleared, and the application returns to the state at which it was when the
program first started. If the user enters an invalid grade, an error message is
displayed and the results box is not updated for that data. For simplicity, the valid
grades are only A, B, C, D and F, rather than the grades with minus and plus.

In the basic task, you may assume that the user always enters a valid grade, and therefore the issue of
displaying an error message or checking for validity of the grade entered by the user does not arise. You
do not also need to make the “Clear” button in the basic task. Essentially, for the basic task, if the user
keeps entering correct data, then the GPA should be computed correctly.

Show your basic tasks to a TA before moving on to Advanced Tasks


In this task, you should implement the complete functionality of validation of grade, displaying error
message and having a “Clear” button. Your application should behave like the sample given.


          GPA is calculated by giving a numeric value of 4 for A, 3 for B, 2 for C, 1 for D and 0 for F grade.
          This value is multiplied by the units of the course to get the GPA for a single course.

          Let us say that you have already calculated the GPA for 3 courses. Now the user enters a fourth
          course. To update the GPA here is what you may do.

GPA = (Units of previous courses * GPA of previous courses + Units of current course * numeric value of current course) / total units

          where total units is simply the sum of the units of the previous courses and the units of the
          current course.

          The label caption at the top of the form changes each time from “Course # 1” to “Course # 2” and
          so on. One way to achieve this is to use two labels, one with just “Course #” on it, and another
          next to it which displays the changing numbers.

To top