-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperson.java
More file actions
78 lines (51 loc) · 1.76 KB
/
person.java
File metadata and controls
78 lines (51 loc) · 1.76 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
public class person{
protected String name;
public person(String name){
this.name = name;
}
public String toString(){
return "NAME:"+name;
}
}
public class Employee extends person{
protected int id;
protected double payrate;
public Employee(int id, double payrate){
super(name);
this.id = id;
this.payrate = payrate;
}
public double pay(){
return payrate;
}
public String toString(){
return super.toString()+"ID:"+id;
}
}
public class faculty extends Employee{
protected String officehours;
protected String teachingcourses[String course,(int coursecode, String coursetitle)];
public faculty(String officehours,String teachingcourses[String course,int coursecode,String coursetitle]){
this.officehours = officehours;
this.teachingcourses = [course,(coursecode,coursetitle)];
}
public String toString(){
return officehours+teachingcourses;
}
}
public class TestPersons{
public static void main(Strings[]args){
public void printPerson(Person p){
System.out.println(p);
}
TestPersons personobj = new TestPersons(person FEYISHOLA);
//person personobj = new person(String FEYISHOLA);
TestPersons Employeeobj = new TestPersons(person p18pscs7016,person 120000);
//person Employeeobj = new Employee(int 7016,double 8000.0);
TestPersons facultyobj = new TestPersons(person physical science);
//person facultyobj = new faculty(String tweleve hours,String obejectoriented[String cosc762, String oop]);
System.out.println("person: " +personobj.printPerson(Person p));
System.out.println("employee: " +Employeeobj.printPerson(Person p));
System.out.println("faculty: " +facultyobj.printPerson(Person p));
}
}