home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ for Dummies (3rd Edition)
/
C_FD.iso
/
CHAP09
/
STUDENT.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-02
|
310b
|
15 lines
// Student.cpp
#include "student.h"
float Student::addCourse(int hours, float grade)
{
float weightedGPA;
weightedGPA = semesterHours * gpa;
//now add in the new course
semesterHours += hours;
weightedGPA += grade * hours;
gpa = weightedGPA / semesterHours;
return gpa;
}