Project 5: Grades  Version P5
This is the basic class project to compute grades
 All Classes Functions Variables
Public Member Functions | Private Attributes | List of all members
Student Class Reference

#include <Student.h>

Public Member Functions

 Student (string last="", string first="")
 
void addHWGrade (double newGrade)
 
void addProjectGrade (double newGrade)
 
void setAttendance (int attendance)
 
void setMidtermGrade (double midterm)
 
void setFinalExam (double finalExam)
 
double getAverage () const
 
string getLastName () const
 
string getFirstName () const
 
void displayGrades (ostream &out) const
 

Private Attributes

string last
 
string first
 
double hwGrades [HW_SIZE]
 
int hwCount
 
double projectGrades [PROJ_SIZE]
 
int projectCount
 
int attendance
 
double midterm
 
double finalExam
 

Detailed Description

This class represents a Student in 1574. They should have a first and last name. They also need 3 variables for their attendance midterm and final exam grades. Additionally, they need two arrays one for project grades and one for homework grades. To be able to average the grades, they also need to keep track of how many homework and projects they actually have.

Constructor & Destructor Documentation

Student::Student ( string  last = "",
string  first = "" 
)

This is the parameterized and default constructor, because the parameters have default values. This will use the given values and set the first and last name to what they values are. Note, only put the default values in the header file, not in the implementation file.

Parameters
last- a string that is the student's last name.
first- a string that is the student's first name.

Member Function Documentation

void Student::addHWGrade ( double  newGrade)

This will attempt to add the newGrade into the array of homework grades. This of course assumes that there is space. If there is no space, then nothing is done. If there is space then the grade is added and the count of homework grades is incremented.

Parameters
newGrade- the grade to be added to the array.
void Student::addProjectGrade ( double  newGrade)

This will attempt to add the newGrade into the array of project grades. This of course assumes that there is space. If there is no space, then nothing is done. If there is space then the grade is added and the count of project grades is incremented.

Parameters
newGrade- the grade to be added to the array.
void Student::displayGrades ( ostream &  out) const

This will display the information about the student. If the student has the name "Dave McPherson" and the grades that are in the display, this is what the display would look like

Name: McPherson, Dave   
Attendance: 9  
Midterm: 89  
Final: 88  
HWs: 100, 90, 80  
Projects: 100, 90, 80  
Average: 89.40  
double Student::getAverage ( ) const

This will compute the average for the grades that are stored. For basic assumptions we will assume all homeworks and projects are worth 100 points. We will assume there are 10 total attendance points. We will assume that the midterm and final exams are out of 100 points a piece.

For weightings, we will use what is in our syllabus.

As a basic idea, we will take the total points a student has earned in a category, divide that by how much they could have earned and multiply it by the weighting. For example, a student attended 8 of the 10 times. So 8 / 10 = .8 * 5 = 4. So 4 points will be added for that category. The average is the sum of the weighted averages for each category.

string Student::getFirstName ( ) const

This will return the student's first name.

Returns
the first name of the student.
string Student::getLastName ( ) const

This will return the student's last name.

Returns
the last name of the student.
void Student::setAttendance ( int  attendance)

Since the attendance is only 1 value we are simply going to set it. For the sake of this project, we are going to say there are 10 total attendances.

Parameters
attendance- the number of times the student attended class.
void Student::setFinalExam ( double  finalExam)

This will set the final exam grade. It will be out of 100 points.

Parameters
finalExam- the grade the student earned on the final exam.
void Student::setMidtermGrade ( double  midterm)

This will set the midterm grade. It will be out of 100 points.

Parameters
midterm- the grade the student earned on the midterm.

Member Data Documentation

int Student::attendance
private

This is the attendance grade for the student.

double Student::finalExam
private

This is the final exam grade.

string Student::first
private

This is the student's first name.

int Student::hwCount
private

This keeps track of how many homework grades have been entered.

double Student::hwGrades[HW_SIZE]
private

This is an array to store the homework grades.

string Student::last
private

This is the student's last name.

double Student::midterm
private

This is the midterm exam grade.

int Student::projectCount
private

This keeps track of how many project grades have been entered.

double Student::projectGrades[PROJ_SIZE]
private

This is an array to store the project grades.


The documentation for this class was generated from the following files: