-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplayer.cpp
More file actions
124 lines (121 loc) · 2.83 KB
/
Copy pathplayer.cpp
File metadata and controls
124 lines (121 loc) · 2.83 KB
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
#include "player.h"
#include <QString>
void Player:: setRuns(int runs) {
this->runs = runs;
}
void Player:: setWickets(int wickets) {
this->wickets = wickets;
}
void Player:: setMatches(int matches) {
this->matches = matches;
}
void Player:: setBallsFaced(int ballsFaced) {
this->ballsFaced = ballsFaced;
}
void Player:: setBallsBowled(int ballsBowled) {
this->ballsBowled = ballsBowled;
}
void Player:: setRunsConceded(int runsConceded) {
this->runsConceded = runsConceded;
}
void Player:: setFours(int fours) {
this->fours = fours;
}
void Player:: setSixes(int sixes) {
this->sixes = sixes;
}
void Player:: setHalfCenturies(int halfCenturies) {
this->halfCenturies = halfCenturies;
}
void Player:: setCenturies(int centuries) {
this->centuries = centuries;
}
void Player:: setStrikeRate(int strikeRate) {
this->strikeRate = strikeRate;
}
void Player:: setAverage(int average) {
this->average = average;
}
void Player:: setHighestScore(int highestScore) {
this->highestScore = highestScore;
}
void Player:: setWides(int wides) {
this->wides = wides;
}
void Player:: setNoBalls(int noBalls) {
this->noBalls = noBalls;
}
void Player::setOut(bool o) { out = o; }
bool Player::isOut() const { return out; }
int Player:: getRuns() {
return runs;
}
int Player:: getWickets() {
return wickets;
}
int Player:: getMatches() {
return matches;
}
int Player:: getBallsFaced() {
return ballsFaced;
}
int Player:: getBallsBowled() {
return ballsBowled;
}
int Player:: getRunsConceded() {
return runsConceded;
}
int Player:: getFours() {
return fours;
}
int Player:: getSixes() {
return sixes;
}
int Player:: getHalfCenturies() {
return halfCenturies;
}
int Player:: getCenturies() {
return centuries;
}
int Player:: getStrikeRate() {
return strikeRate;
}
int Player:: getAverage() {
return average;
}
int Player:: getHighestScore() {
return highestScore;
}
int Player:: getWides() {
return wides;
}
int Player:: getNoBalls() {
return noBalls;
}
// Additional methods to calculate strike rate and average
double Player:: calculateStrikeRate() {
if (ballsFaced == 0) return 0;
return (static_cast<double>(runs) / ballsFaced) * 100;
}
double Player:: calculateAverage() {
if (matches == 0) return 0;
return static_cast<double>(runs) / matches;
}
double Player:: calculateBowlingAverage() {
if (wickets == 0) return 0;
return static_cast<double>(runsConceded) / wickets;
}
double Player:: calculateEconomyRate() {
if (ballsBowled == 0) return 0;
return static_cast<double>(runsConceded) / (ballsBowled / 6);
}
double Player:: calculateBowlingStrikeRate() {
if (wickets == 0) return 0;
return static_cast<double>(ballsBowled) / wickets;
}
QString Player:: getName() {
return name;
}
int Player:: getjurseyNumber() {
return jurseyNum;
}