-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPioneer.java
executable file
·39 lines (33 loc) · 1.09 KB
/
Pioneer.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
/**
* each object of pioneer class contain data of pioneer
* getter for first name, last name, and notoriety field
* toString method return first name, last name , notoriety
* compareTo method: compare object w.r.t to first name (helper method for sort method in sort class)
* */
public class Pioneer implements Comparable{
private String firstName = "";
private String secondName = "";
private String notoriety = "";
public Pioneer(String firstName, String secondName, String notoriety){
this.firstName = firstName;
this.secondName = secondName;
this.notoriety = notoriety;
}
public String getFirstName() {
return firstName;
}
public String getSecondName() {
return secondName;
}
public String getNotoriety() {
return notoriety;
}
@Override
public String toString() {
return firstName +" , "+ secondName +" , "+ notoriety;
}
@Override
public int compareTo(Object o) {
return firstName.compareTo(((Pioneer)o).getFirstName());
}
}