@@ -15,7 +15,11 @@ public class Formula1Car {
15
15
private TyreCompound currTyre ;
16
16
private boolean drs ;
17
17
18
- // constructors
18
+ /**
19
+ * Default Constructor for a Formula1Car with no team, empty
20
+ * sponsors array, empty driver name, driver number 0, no tyre
21
+ * compound, and DRS is disabled by default
22
+ */
19
23
public Formula1Car () {
20
24
this .team = null ;
21
25
this .sponsors = new String [0 ];
@@ -24,7 +28,17 @@ public Formula1Car() {
24
28
this .currTyre = null ;
25
29
this .drs = false ;
26
30
}
27
-
31
+ /**
32
+ * @param team the tean that this Formula1Car belongs
33
+ * @param sponsors array of sponsor names accosicated with this Formula1Car
34
+ * @param driverName the name of the driver of this Formula1Car
35
+ * @param driverNum the drivers number for the Formula1Car
36
+ * @param position drivers current racing position on the grid
37
+ * @param currTyre current TyreCompound fitted on this Formula1Car
38
+ *
39
+ * @see Team
40
+ * @see TyreCompound
41
+ */
28
42
public Formula1Car (
29
43
Team team ,
30
44
String [] sponsors ,
@@ -41,7 +55,14 @@ public Formula1Car(
41
55
this .drs = false ;
42
56
}
43
57
44
- // methods
58
+ /**
59
+ * Displays a header line then,
60
+ * Prints a list of sponsors to the console.
61
+ *
62
+ * @throws NoSponsorsException if there are no sponsors associated with this Formula1Car
63
+ *
64
+ * @see NoSponsorsException
65
+ */
45
66
public void printSponsors () throws NoSponsorsException {
46
67
if (sponsors .length == 0 ) {
47
68
throw new NoSponsorsException (team + " has no Sponsors" );
@@ -52,15 +73,33 @@ public void printSponsors() throws NoSponsorsException {
52
73
}
53
74
}
54
75
}
55
-
76
+ /**
77
+ * Checks if DRS (Drag Reduction System) is availible to use
78
+ * This method determines DRS availibility based on weather or not
79
+ * your Formula1Car is in the current track's designated DRS zone.
80
+ *
81
+ * @return {@code true} if DRS is availible (track has a DRS zone),
82
+ * {@code false} otherwise
83
+ *
84
+ * @see Track#isDrsZone()
85
+ */
56
86
public boolean isDrsAvailible () {
57
87
if (track .isDrsZone ()) {
58
88
this .drs = true ;
59
89
return true ;
60
90
}
61
91
return false ;
62
92
}
63
-
93
+ /**
94
+ * Checks if we need to switch race strategy to account for the rainy weather
95
+ * if the weather is LIGHT_RAIN we change the TyreCompound to INTERMEDIATE
96
+ * if the weather is HEAVY_RAIN we change the TyreCompound to WET
97
+ *
98
+ * @return {@code true} if track.getWeather is LIGHT_RAIN || HEAVY_RAIN
99
+ * {@code false} otherwise
100
+ *
101
+ * @see Track#getWeather()
102
+ */
64
103
public boolean rainStrategy () {
65
104
if (track .getWeather () == Weather .LIGHT_RAIN ) {
66
105
this .currTyre = TyreCompound .INTERMEDIATE ;
0 commit comments