Project 5: Grades  Version P5
This is the basic class project to compute grades
 All Classes Functions Variables
Student.h
1 //
2 // Student.h
3 // Fall14Project5
4 //
5 // Created by David McPherson on 11/17/14.
6 // Copyright (c) 2014 David McPherson. All rights reserved.
7 //
8 
9 #ifndef __Student__
10 #define __Student__
11 
12 
13 #include <string>
14 #include <iostream>
15 #include <iomanip>
16 
17 using std::ostream;
18 using std::string;
19 using std::endl;
20 /**
21 This constant is the maximum size for the homework grades array.
22 */
23 const int HW_SIZE = 20;//this is used for the total number of Homeworks we can have
24 /**
25 This constant is the maximum size for the project grades array.
26 */
27 const int PROJ_SIZE = 5;//this is used for the total number of Projects we can have
28 
29 /**
30 This class represents a Student in 1574. They should have a first and last name. They also need 3 variables for their attendance
31 midterm and final exam grades. Additionally, they need two arrays one for project grades and one for homework grades. To be able
32 to average the grades, they also need to keep track of how many homework and projects they actually have.
33 */
34 class Student
35 {
36 private:
37  /**
38  This is the student's last name.
39  */
40  string last;//the student's last name
41  /**
42  This is the student's first name.
43  */
44  string first;//the student's first name
45  /**
46  This is an array to store the homework grades.
47  */
48  double hwGrades[HW_SIZE];//an array for the homegrades
49  /**
50  This keeps track of how many homework grades have been entered.
51  */
52  int hwCount;//how many homework grades we have
53  /**
54  This is an array to store the project grades.
55  */
56  double projectGrades[PROJ_SIZE];//an array for the project grades
57  /**
58  This keeps track of how many project grades have been entered.
59  */
60  int projectCount;//how many projects we have
61  /**
62  This is the attendance grade for the student.
63  */
64  int attendance;//attendance points
65  /**
66  This is the midterm exam grade.
67  */
68  double midterm;//midterm exam score
69  /**
70  This is the final exam grade.
71  */
72  double finalExam;//final exam score
73 public:
74  /**
75  This is the parameterized and default constructor, because the parameters have default values.
76  This will use the given values and set the first and last name to what they values are.
77  Note, only put the default values in the header file, not in the implementation file.
78  @param last - a string that is the student's last name.
79  @param first - a string that is the student's first name.
80  */
81  Student(string last="", string first="" );
82 
83  /**
84  This will attempt to add the newGrade into the array of homework grades. This of course assumes that there is space.
85  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.
86  @param newGrade - the grade to be added to the array.
87  */
88  void addHWGrade( double newGrade );
89  /**
90  This will attempt to add the newGrade into the array of project grades. This of course assumes that there is space.
91  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.
92  @param newGrade - the grade to be added to the array.
93  */
94  void addProjectGrade( double newGrade );
95  /**
96  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.
97  @param attendance - the number of times the student attended class.
98  */
99  void setAttendance( int attendance );
100  /**
101  This will set the midterm grade. It will be out of 100 points.
102  @param midterm - the grade the student earned on the midterm.
103  */
104  void setMidtermGrade( double midterm );
105  /**
106  This will set the final exam grade. It will be out of 100 points.
107  @param finalExam - the grade the student earned on the final exam.
108  */
109  void setFinalExam( double finalExam );
110 
111  /**
112  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.
113 
114  For weightings, we will use what is in our [syllabus](https://filebox.ece.vt.edu/~ece1574/fall14/syllabus.html).
115 
116  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.
117  */
118  double getAverage() const;
119  /**
120  This will return the student's last name.
121  @return the last name of the student.
122  */
123  string getLastName() const;
124  /**
125  This will return the student's first name.
126  @return the first name of the student.
127  */
128  string getFirstName() const;
129  /**
130  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
131  would look like
132  <pre>
133  Name: McPherson, Dave
134  Attendance: 9
135  Midterm: 89
136  Final: 88
137  HWs: 100, 90, 80
138  Projects: 100, 90, 80
139  Average: 89.40
140  </pre>
141 
142  */
143  void displayGrades( ostream& out ) const;
144 };
145 
146 
147 #endif /* defined(__Fall14Project5__Student__) */