-
Notifications
You must be signed in to change notification settings - Fork 0
/
Student.java
51 lines (50 loc) · 1.27 KB
/
Student.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
40
41
42
43
44
45
46
47
48
49
50
51
import java.io.*;
class Student extends Personal
{
protected int facultyLen = 20;
protected String faculty;
public Student()
{
super();
}
public Student(int ssn, String n, String c, short yob, double sal, String faculty)
{
super(ssn, n, c, yob, sal);
this.faculty = faculty;
this.faculty = this.faculty.substring(0, facultyLen);
}
public void readFromConsole() throws IOException
{
super.readFromConsole();
System.out.print("Enter faculty: ");
this.faculty = sc.next();
sc.nextLine();
for(int i = this.faculty.length(); i < facultyLen; i++)
{
this.faculty += " ";
}
}
public void readFromFile(RandomAccessFile in) throws IOException
{
super.readFromFile(in);
this.faculty = readString(facultyLen, in);
}
public void writeToFile(RandomAccessFile out) throws IOException
{
super.writeToFile(out);
writeString(faculty, out);
}
public void display()
{
super.display();
System.out.print(", Faculty: " + faculty.trim());
}
public long size()
{
return super.size() + 2 * facultyLen;
}
// public int getUID()
// {
// return SSN;
// }
}