-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparticipant.cpp
68 lines (67 loc) · 1.3 KB
/
participant.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
#include "./../include/participant.hh"
participant::participant(int n)
{
cout << "Enter the name of participant " << n << ":\n";
getline(cin >> ws, name);
cout << "\n";
return;
}
void participant::addScore(double score)
{
totalScore = totalScore + score;
maxScore = max(maxScore, score);
return;
}
void participant::addAccuracy(double accuracy)
{
averageAccuracy = (averageAccuracy + accuracy) / 2;
}
void participant::addSpeed(double speed)
{
averageSpeed = (averageSpeed + speed) / 2;
}
string participant::getName()
{
return name;
}
double participant::getTotalScore()
{
return totalScore;
}
double participant::getMaxScore()
{
return maxScore;
}
double participant::getAverageAccuracy()
{
return averageAccuracy;
}
double participant::getAverageSpeed()
{
return averageSpeed;
}
void participant::printName()
{
cout << name;
return;
}
void participant::printTotalScore()
{
cout << fixed << setprecision(2) << totalScore;
return;
}
void participant::printMaxScore()
{
cout << fixed << setprecision(2) << maxScore;
return;
}
void participant::printAverageAccuracy()
{
cout << fixed << setprecision(2) << averageAccuracy;
return;
}
void participant::printAverageSpeed()
{
cout << fixed << setprecision(2) << averageSpeed;
return;
}