-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathteam.cpp
More file actions
83 lines (66 loc) · 1.36 KB
/
Copy pathteam.cpp
File metadata and controls
83 lines (66 loc) · 1.36 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
#include "team.h"
Team::Team() {
teamName = "";
playerCount = 0;
totalScore = 0;
wicketsLost = 0;
oversBowled = 0;
for (int i = 0; i < 11; i++)
players[i] = nullptr;
}
Team::Team(QString name) {
teamName = name;
playerCount = 0;
totalScore = 0;
wicketsLost = 0;
oversBowled = 0;
for (int i = 0; i < 11; i++)
players[i] = nullptr;
}
void Team::setTeamName(QString name) {
teamName = name;
}
QString Team::getTeamName() const {
return teamName;
}
void Team::setPlayer(int index, Player* p) {
if (index >= 0 && index < 11)
players[index] = p;
}
Player* Team::getPlayer(int index) const {
if (index >= 0 && index < 11)
return players[index];
return nullptr;
}
int Team::getPlayerCount() const {
return playerCount;
}
void Team::incrementPlayerCount() {
if (playerCount < 11)
playerCount++;
}
void Team::addRuns(int runs) {
totalScore += runs;
}
void Team::addWicket() {
if (wicketsLost < 10)
wicketsLost++;
}
void Team::addOver() {
oversBowled++;
}
int Team::getTotalScore() const {
return totalScore;
}
int Team::getWicketsLost() const {
return wicketsLost;
}
int Team::getOversBowled() const {
return oversBowled;
}
void Team::setScore(int score){
totalScore=score;
}
void Team::setWicketsLost(int wk){
wicketsLost=wk;
}