-
Notifications
You must be signed in to change notification settings - Fork 0
/
Coaches.java
75 lines (75 loc) · 2.33 KB
/
Coaches.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
import java.util.Scanner;
/**
* Description of class Coaches: Subclass of abstract class
* Staff, contains more information about head coaches of the NBA
* Including theirs wins and losses over their careers as a coach
* @author Aaron Amalraj
* @version 12.16.2022
*/
public class Coaches extends Staff
{
// private instance variables
private int wins; // total wins the coach has had in their career
private int losses; //total losses the coach has had in their career
private String practiceNextDateAndTime; //date and time of next practice set by coach
/**
* Constructor for objects of class Coaches
*/
public Coaches(double height, double weight, String name, int yearsExperience, int wins, int losses)
{
this.height = height;
this.weight = weight;
this.name = name;
this.yearsExperience = yearsExperience;
this.wins = wins;
this.losses = losses;
//this.practiceNextDateAndTime = ""; //defaults to empty unless changed by user
}
/**
* Additional Getter methods
* This method is to getWins
*/
public int getWins(){
return wins;
}
/**
* Method to getLosses
*/
public int getLosses(){
return losses;
}
/**
* Additional setter methods
* This method is to set the wins
*/
public void setWins(int wins){
this.wins = wins;
}
/**
* This method is to set the losses
*/
public void setLosses(int losses){
this.losses = losses;
}
/**
* Override the abstract toString() method in Staff Class
* Use generalPrintString to avoid repetition
*/
@Override
public String toString()
{
String coachString = "\n The name of the head coach is: "
+ name + printGeneral() + " The next scheduled practice time and date will be: " + practiceNextDateAndTime +
" the coaches win loss ratio is " + wins + "-" + losses;
return coachString;
}
/**
* Override the practice string using Scanner
* Ask the user for next scheduled practice
*/
public void practice(){
Scanner keybd = new Scanner(System.in);
System.out.println("As head coach please enter the next scheduled practice time and date");
practiceNextDateAndTime = keybd.nextLine();
}
}