'Added USOS mockup;'

This commit is contained in:
Arkadiusz Hypki 2024-03-07 10:59:53 +01:00
parent 8323cbba7f
commit 4a8e7fb1aa
6 changed files with 152 additions and 0 deletions

View 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");
}
}

View 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;
};
}

View 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;
}
}

View 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
// .....
}
}

View 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;
}
}

View File

@ -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;
}
}