-
Notifications
You must be signed in to change notification settings - Fork 0
/
Grade.cpp
180 lines (154 loc) · 5.01 KB
/
Grade.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/******************************************************************************/
/*!
\file Grade.cpp
\author Paul Huffman
\par email: huffmanp4\@nku.edu
\par Course: CSC402
\par Section: 001
\par Assignment: 3
\date 3/06/2022
\brief
This file contains the implementation of the grade class.
Functions included:
getEarned()
getTotal()
getWeight()
getAssignment()
setEarned()
setTotal()
setWeight()
setAssignment()
setAll()
score()
Hours spent on this assignment: 10
Specific portions that gave you the most trouble: Student
*/
/******************************************************************************/
#include "Grade.h"
#include <utility>
/****************************************************************************/
/*!
\brief
This function will return an int that contains the number of points
earned.
\return
This function will return an int that contains the number of points
earned on an assignment.
*/
/****************************************************************************/
int Grade::getEarned() const {
return pointsEarned_;
}
/****************************************************************************/
/*!
\brief
This function will return an int that contains the number of points
for an assignemtn.
\return
This function will return an int that contains the number of points for
an assignment.
*/
/****************************************************************************/
int Grade::getTotal() const {
return totalPoints_;
}
/****************************************************************************/
/*!
\brief
This function will return a double that contains the weight of an
assignment.
\return
This function will return a double containing the weight of an assignment.
*/
/****************************************************************************/
double Grade::getWeight() const {
return weight_;
}
/****************************************************************************/
/*!
\brief
This function will return a string containing the name of an assignment.
\return
This function will return a string that contains the name of an
assignment.
*/
/****************************************************************************/
std::string Grade::getAssignment() {
return assignment_;
}
/****************************************************************************/
/*!
\brief
This function will set the number of points earned on an assignment.
\param earned
This is an int that contains the number of points earned on an assignment.
*/
/****************************************************************************/
void Grade::setEarned(int earned) {
pointsEarned_ = earned;
}
/****************************************************************************/
/*!
\brief
This function will set the total number of points for an assignment.
\param total
This is an int containing the total points for an assignment.
*/
/****************************************************************************/
void Grade::setTotal(int total) {
totalPoints_ = total;
}
/****************************************************************************/
/*!
\brief
This function will set the weight for an assignment.
\param weight
This is a double containing the weight of an assignment.
*/
/****************************************************************************/
void Grade::setWeight(double weight) {
weight_ = weight;
}
/****************************************************************************/
/*!
\brief
This function will set the name for an assignment.
\param assignment
This is a string containing the name of an assignment.
*/
/****************************************************************************/
void Grade::setAssignment(std::string assignment) {
assignment_ = std::move(assignment);
}
/****************************************************************************/
/*!
\brief
This function will call all other setting functions.
\param earned
This is an int that contains the number of points earned on an assignment.
\param total
This is an int containing the total points for an assignment.
\param weight
This is a double containing the weight of an assignment.
\param assignment
This is a string containing the name of an assignment.
*/
/****************************************************************************/
void Grade::setAll(int earned, int total, double weight, std::string assignment) {
setEarned(earned);
setTotal(total);
setWeight(weight);
setAssignment(std::move(assignment));
}
/****************************************************************************/
/*!
\brief
This function will calculate the score for an assignment.
/return
This function will contain a double that is the calculated score for an
assignment.
*/
/****************************************************************************/
double Grade::score() const{
return (((double)pointsEarned_/totalPoints_)*100);
}