-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHurricaneRowData.java
More file actions
48 lines (48 loc) · 1.47 KB
/
HurricaneRowData.java
File metadata and controls
48 lines (48 loc) · 1.47 KB
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
//Game plan: start with hurricanerowdata class, declare instance variables, a constructor,
//getters and setters here
public class HurricaneRowData
{
//Declare instance variables here
private int year;
private int aceIndex;
private int numberOfTropicalStorms;
private int numberOfHurricanes;
private int numberOfMajorHurricanes;
//Constructor
public HurricaneRowData(int year, int aceIndex, int numberOfTropicalStorms, int numberOfHurricanes, int numberOfMajorHurricanes)
{
this.year = year;
this.aceIndex = aceIndex;
this.numberOfTropicalStorms = numberOfTropicalStorms;
this.numberOfHurricanes = numberOfHurricanes;
this.numberOfMajorHurricanes = numberOfMajorHurricanes;
}
//Getters and setters
//Note: I made a getter of all variables for practice sake
public int getYear()
{
return year;
}
public int getAceIndex()
{
return aceIndex;
}
public int getNumberOfTropicalStorms()
{
return numberOfTropicalStorms;
}
public int getNumberOfHurricanes()
{
return numberOfHurricanes;
}
public int getNumberOfMajorHurricanes()
{
return numberOfMajorHurricanes;
}
//toString method, had to rewrite because it looked unreadable
@Override
public String toString()
{
return String.format("%5d%5d%5d%5d%5d", year, aceIndex, numberOfTropicalStorms, numberOfHurricanes, numberOfMajorHurricanes);
}
}