-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
170 lines (148 loc) · 3.33 KB
/
Player.java
File metadata and controls
170 lines (148 loc) · 3.33 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
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
/**
* The player class oversees the Player object, which is used in part to rank a team's strength and hold stats
* The player holds stats and ranked mmr in its calculations
* @author oscarfilson
*/
public class Player {
private String name;
private double playerScore;
private int goals;
private int assists;
private int saves;
private int shots;
private int gamesPlayed;
private int wins;
private double adjustedSalary;
/**
* Makes a new Player object
* @param String - the name of the player
*/
public Player(String name) {
this.name = name;
}
/**
* Returns the name of the player
* @return name
*/
public String getName() {
return name;
}
public void setPlayerScore(double playerScore) {
this.playerScore = playerScore;
}
public double getPlayerScore() {
return playerScore;
}
/**
* Returns the total goals of the player
* @return goals
*/
public int getGoals() {
return goals;
}
/**
* Adds to the total goals of the player
* @param goals
*/
public void addGoals(int goals) {
this.goals += goals;
}
/**
* Returns the assists of the player
* @return assists
*/
public int getAssists() {
return assists;
}
/**
* Adds to the total assists of the player
* @param assists
*/
public void addAssists(int assists) {
this.assists += assists;
}
/**
* Returns the saves of the player
* @return saves
*/
public int getSaves() {
return saves;
}
/**
* Adds to the total saves of the player
* @param saves
*/
public void addSaves(int saves) {
this.saves += saves;
}
/**
* Returns the shots of the player
* @return shots
*/
public int getShots() {
return shots;
}
/**
* Adds to the total shots of the player
* @param shots
*/
public void addShots(int shots) {
this.shots += shots;
}
/**
* Returns the amount of games the player has played
* @return gamesPlayed
*/
public int getGamesPlayed() {
return gamesPlayed;
}
/**
* Adds to the 5 games to the player's gamesPlayed
*/
public void addGamesPlayed() {
gamesPlayed += 5;
}
/**
* Returns the amount of games the player has won
* @return wins
*/
public int getWins() {
return wins;
}
/**
* Adds wins to the player's totalWins
* @param wins
*/
public void addWins(int wins) {
this.wins += wins;
}
/**
* Sets the adjusted salary of the player, which is based off MVPR and win percentages.
* @param adjustedSalary
*/
public void setAdjustedSalary(double adjustedSalary) {
this.adjustedSalary = adjustedSalary;
}
/**
* Returns the adjusted salary of the player, which is based off MVPR and win percentages.
* @return adjustedSalary
*/
public double getAdjustedSalary() {
return adjustedSalary;
}
/**
* Calculates the adjusted salary of a player.
* @param int teamWins, the amount of wins the team has had as a whole.
*/
public void calculateAdjustedSalary(int teamWins) {
double adjSalary = 0.0;
double MVPR = 0.0;
double winPercentage = 0.0;
double teamWinPercentage = 0.0;
MVPR = (((double) goals) + ((double) assists*.75) + ((double) saves*.6) + ((double) shots/3))/((double) gamesPlayed);
winPercentage = ((double) wins)/ ((double) gamesPlayed);
teamWinPercentage = ((double) wins)/ ((double) teamWins);
adjSalary = (double) (MVPR*teamWinPercentage*winPercentage);
this.setAdjustedSalary(adjSalary);
}
}