-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudent.java
More file actions
52 lines (44 loc) · 1.19 KB
/
student.java
File metadata and controls
52 lines (44 loc) · 1.19 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
/**
The Student class is an abstract class that holds
general data about a student. Classes representing
specific types of students should inherit from
this class.
*/
public abstract class student
{
private String name; // Student name
private String idNumber; // Student ID
private int yearAdmitted; // Year admitted
/**
The Constructor sets the student's name,
ID number, and year admitted.
@param n The student's name.
@param id The student's ID number.
@param year The year the student was admitted.
*/
public student(String n, String id, int year)
{
name = n;
idNumber = id;
yearAdmitted = year;
}
/**
The toString method returns a String containing
the student's data.
@return A reference to a String.
*/
public String toString()
{
String str;
str = "Name: " + name
+ "\nID Number: " + idNumber
+ "\nYear Admitted: " + yearAdmitted;
return str;
}
/**
The getRemainingHours method is abstract.
It must be overridden in a subclass.
@return The hours remaining for the student.
*/
public abstract int getRemainingHours();
}