-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
91 lines (82 loc) · 1.99 KB
/
Copy pathStudent.java
File metadata and controls
91 lines (82 loc) · 1.99 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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
public class Student implements Comparable<Student> {
private String Student_no;
private String Name;
private String Surname;
/***
* Method to create the student object
* @param student_no contains the student ID
* @param name contains the student name
* @param surname conatins the student surname
*/
public Student(String student_no, String name, String surname)
{
Student_no = student_no;
Name = name;
Surname = surname;
}
/**
* Method to return the student ID
* @return returns the string value of the student ID
*/
public String getStudent_no()
{
return Student_no;
}
/**
* Method to update the student ID
* @param student_no contains the new student ID
*/
public void setStudent_no(String student_no)
{
Student_no = student_no;
}
/**
* Method to return the student name
* @return returns the string value of the name
*/
public String getName()
{
return Name;
}
public void setName(String name)
{
Name = name;
}
/**
*
* @return
*/
public String getSurname()
{
return Surname;
}
/**
*
* @param surname
*/
public void setSurname(String surname)
{
Surname = surname;
}
/**
*
* @return
*/
@Override
public String toString()
{
return "Student_no: " + Student_no + ' ' +
", Name: " + Name + ' ' +
", Surname: " + Surname + ' ';
}
/**
* Method to compare two Student objects using their student ID
* @param target contains the object to compare with
* @return returns 0, negative if less than and positive integer if current object is greater than target object.
*/
@Override
public int compareTo(Student target)
{
return (this.getStudent_no().compareTo(target.getStudent_no()));
}
}