-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefensivePlayer.java
90 lines (71 loc) · 1.82 KB
/
DefensivePlayer.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
import java.util.Random;
/**
* Program: Defensive Player Class
* File: DefensivePlayer.java
* Summary: Class that builds a defensive player and their stats
* Author: Ronald Pearl
* Date: July 23, 2016
**/
public class DefensivePlayer extends NFLPlayer implements Celebrator {
protected int tackles = 0;
protected double sacks = 0;
protected int safeties = 0;
protected int interceptions = 0;
// overrides
protected String playerName = "";
protected int playerNum;
DefensivePlayer(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!";
}
// Getters
public int getTackles() {
return tackles;
}
public double getSacks() {
return sacks;
}
public int getSafeties() {
return safeties;
}
public int getInterceptions() {
return interceptions;
}
@Override
public String getPlayerName() {
return playerName;
}
@Override
public int getPlayerNum() {
return playerNum;
}
// Setters
public void setTackles(int plyrTackles) {
tackles = plyrTackles;
}
public void setSacks(double plyrSacks) {
sacks = plyrSacks;
}
public void setSafeties(int plyrSafeties) {
safeties = plyrSafeties;
}
public void setInterceptions(int plyrInt) {
interceptions = plyrInt;
}
@Override
public void setPlayerName(String plyrName) {
playerName = plyrName;
}
@Override
public void setPlayerNum(int plyrNum) {
playerNum = plyrNum;
}
}