-
Notifications
You must be signed in to change notification settings - Fork 0
/
Players.java
70 lines (68 loc) · 2.2 KB
/
Players.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
import java.util.Scanner;
/**
* Description of class Players: class for NBA Players
* @author Aaron Amalraj
* @version 12.16.22
*/
public class Players extends Staff
{
// instance variables
String position; //position in basketball for the player
double ppg; //points per game averaged
String decision;
/**
* Constructor for objects of class Players
*/
public Players(double height, double weight, String name, int yearsExperience,String position,double ppg)
{
this.height = height;
this.weight = weight;
this.name = name;
this.yearsExperience = yearsExperience;
this.position = position;
this.ppg = ppg;
decision = "yes"; //defaults to yes unless changed in practice method
}
/**
* Setter methods
*/
/**
* Method to set the position of the player
* @param String for the position of the player to be entered
*/
public void setPosition(String position){
this.position = position;
}
/**
* Method to set the points averaged per game by the player
* @param takes in an int for points averaged
*/
public void setPpg(double ppg){
this.ppg = ppg;
}
/**
* Override the abstract toString() method in Staff Class
* Use generalPrintString to avoid repetition
* @return returns the player String with information about the player
*/
@Override
public String toString()
{
String playerString = " The name of the player is: "
+ name + printGeneral() + "status on availabilty next practice: " + decision +
" the position played by the player is " + position +
" And points averaged per game is " + ppg;
return playerString;
}
/**
* Override the practice method
* decision is the decision of whether the player will go to practice
* For example, yes, no or maybe
*/
public void practice(){
Scanner keybd = new Scanner(System.in);
System.out.println("As a player on the team please let us know whether you'd be able to make the next scheduled practice");
decision = keybd.nextLine();
this.decision = decision;
}
}