'Added USOS mockup;'
This commit is contained in:
parent
8323cbba7f
commit
4a8e7fb1aa
34
02_UsosMockup2/src/net/hypki/USOS/Main.java
Normal file
34
02_UsosMockup2/src/net/hypki/USOS/Main.java
Normal file
@ -0,0 +1,34 @@
|
||||
package net.hypki.USOS;
|
||||
|
||||
import net.hypki.USOS.db.DB;
|
||||
import net.hypki.USOS.model.Person;
|
||||
import net.hypki.USOS.model.Student;
|
||||
import net.hypki.USOS.model.UniversityFaculty;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello");
|
||||
|
||||
Student s = new Student();
|
||||
s.setFirstname("Jan");
|
||||
s.setSurname("Kowalski");
|
||||
System.out.println("Student " + s);
|
||||
|
||||
UniversityFaculty f = new UniversityFaculty();
|
||||
f.setFirstname("Jan");
|
||||
f.setSurname("Nowak");
|
||||
f.setDepartment("WMI");
|
||||
System.out.println("Pracownik naukowy: " + f);
|
||||
|
||||
// Person p = new Person();
|
||||
|
||||
DB db = new DB();
|
||||
|
||||
Student s1 = (Student) db.get("3628482");
|
||||
System.out.println(s1.getCurrentStudyYear());
|
||||
|
||||
UniversityFaculty f1 = (UniversityFaculty) db.get("ahypki@amu.edu.pl");
|
||||
}
|
||||
|
||||
}
|
10
02_UsosMockup2/src/net/hypki/USOS/db/DB.java
Normal file
10
02_UsosMockup2/src/net/hypki/USOS/db/DB.java
Normal file
@ -0,0 +1,10 @@
|
||||
package net.hypki.USOS.db;
|
||||
|
||||
import net.hypki.USOS.model.Person;
|
||||
|
||||
public class DB {
|
||||
|
||||
public Person get(String key) {
|
||||
return null;
|
||||
};
|
||||
}
|
32
02_UsosMockup2/src/net/hypki/USOS/model/Person.java
Normal file
32
02_UsosMockup2/src/net/hypki/USOS/model/Person.java
Normal file
@ -0,0 +1,32 @@
|
||||
package net.hypki.USOS.model;
|
||||
|
||||
public abstract class Person {
|
||||
|
||||
private String firstname = null;
|
||||
|
||||
private String surname = null;
|
||||
|
||||
public abstract void terminate();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getFirstname() + " " + getSurname();
|
||||
}
|
||||
|
||||
public String getFirstname() {
|
||||
return firstname;
|
||||
}
|
||||
|
||||
public void setFirstname(String firstname) {
|
||||
// TODO validate
|
||||
this.firstname = firstname;
|
||||
}
|
||||
|
||||
public String getSurname() {
|
||||
return surname;
|
||||
}
|
||||
|
||||
public void setSurname(String surname) {
|
||||
this.surname = surname;
|
||||
}
|
||||
}
|
15
02_UsosMockup2/src/net/hypki/USOS/model/Staff.java
Normal file
15
02_UsosMockup2/src/net/hypki/USOS/model/Staff.java
Normal file
@ -0,0 +1,15 @@
|
||||
package net.hypki.USOS.model;
|
||||
|
||||
public class Staff extends Person {
|
||||
|
||||
public Staff() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate() {
|
||||
// 1. invalidate credentials
|
||||
// 2. remove from paycheck
|
||||
// .....
|
||||
}
|
||||
}
|
30
02_UsosMockup2/src/net/hypki/USOS/model/Student.java
Normal file
30
02_UsosMockup2/src/net/hypki/USOS/model/Student.java
Normal file
@ -0,0 +1,30 @@
|
||||
package net.hypki.USOS.model;
|
||||
|
||||
public class Student extends Person {
|
||||
|
||||
private int currentStudyYear = 1;
|
||||
|
||||
public Student() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate() {
|
||||
// 1. remove from student list
|
||||
// 2. .....
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " year " + getCurrentStudyYear();
|
||||
}
|
||||
|
||||
public int getCurrentStudyYear() {
|
||||
return currentStudyYear;
|
||||
}
|
||||
|
||||
public void setCurrentStudyYear(int currentStudyYear) {
|
||||
this.currentStudyYear = currentStudyYear;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package net.hypki.USOS.model;
|
||||
|
||||
public class UniversityFaculty extends Person {
|
||||
|
||||
private String department = null;
|
||||
|
||||
public UniversityFaculty() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate() {
|
||||
// 1. invalidate credentials
|
||||
// 2. remove from paycheck
|
||||
// 3. find substitutes for teaching
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " (" + getDepartment() + ")";
|
||||
}
|
||||
|
||||
public String getDepartment() {
|
||||
return department;
|
||||
}
|
||||
|
||||
public void setDepartment(String department) {
|
||||
this.department = department;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user