-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOffensivePlayer.java
124 lines (98 loc) · 2.56 KB
/
OffensivePlayer.java
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
/**
* Program: Offensive Player Class
* File: OffensivePlayer.java
* Summary: Class that builds an offensive player and their stats
* Author: Ronald Pearl
* Date: July 23, 2016
**/
import java.util.Random;
public class OffensivePlayer extends NFLPlayer implements Celebrator {
protected int receptions = 0;
protected int fieldGoalsMade = 0;
protected int carries = 0;
protected double yardsPerCarry = 0;
protected int rushingYards = 0;
protected int touchdowns = 0;
protected double yardsPerPass = 0;
protected double yardsPerReception = 0;
// overrides
protected String playerName = "";
protected int playerNum;
OffensivePlayer(String playerName, String playerPosition, int playerNum, String playerTeam) {
super(playerPosition, playerTeam);
setPlayerName(playerName);
setPlayerNum(playerNum);
}
// Celebrate method from Celebrator interface
public String celebrate() {
// Get random celebrate option
int celebRandomInt = new Random().nextInt(Celebrator.waysToCelebrate.length);
String randCelebration = (Celebrator.waysToCelebrate[celebRandomInt]);
return this.playerName + " " + randCelebration + " to celebrate his draft!";
}
public int getReceptions() {
return receptions;
}
public int getFieldGoalsMade() {
return fieldGoalsMade;
}
public int getCarries() {
return carries;
}
public double getYardsPerCarry() {
return yardsPerCarry;
}
public int getTotalYards() {
return rushingYards;
}
public int getTouchdowns() {
return touchdowns;
}
public double getYardsPerPass() {
return yardsPerPass;
}
public double getYardsPerReception() {
return yardsPerReception;
}
@Override
public String getPlayerName() {
return playerName;
}
@Override
public int getPlayerNum() {
return playerNum;
}
// Setters
public void setReceptions(int plyrReceptions) {
receptions = plyrReceptions;
}
public void setFieldGoalsMade(int plyrFGMade) {
fieldGoalsMade = plyrFGMade;
}
public void setCarries(int plyrCarries) {
carries = plyrCarries;
}
public void setYardsPerCarry(double plyrYPC) {
yardsPerCarry = plyrYPC;
}
public void setRushingYards(int plyrTotalYds) {
rushingYards = plyrTotalYds;
}
public void setTouchdowns(int plyrTDs) {
touchdowns = plyrTDs;
}
public void setYardsPerPass(double plyrYPP) {
yardsPerPass = plyrYPP;
}
public void setYardsPerReception(double plyrYPR) {
yardsPerReception = plyrYPR;
}
@Override
public void setPlayerName(String plyrName) {
playerName = plyrName;
}
@Override
public void setPlayerNum(int plyrNum) {
playerNum = plyrNum;
}
}