From 542c30a043378ea48936e7c28bea55d4aa155abc Mon Sep 17 00:00:00 2001 From: Arkadiusz Hypki Date: Thu, 7 Mar 2024 12:24:56 +0100 Subject: [PATCH] 'Added USOS4 mockup;' --- 02_UsosMockup4/src/net/hypki/USOS4/Main.java | 21 +++++++++++++ .../src/net/hypki/USOS4/model/Faculty.java | 26 ++++++++++++++++ .../src/net/hypki/USOS4/model/Person.java | 31 +++++++++++++++++++ .../src/net/hypki/USOS4/model/Student.java | 24 ++++++++++++++ 4 files changed, 102 insertions(+) create mode 100644 02_UsosMockup4/src/net/hypki/USOS4/Main.java create mode 100644 02_UsosMockup4/src/net/hypki/USOS4/model/Faculty.java create mode 100644 02_UsosMockup4/src/net/hypki/USOS4/model/Person.java create mode 100644 02_UsosMockup4/src/net/hypki/USOS4/model/Student.java diff --git a/02_UsosMockup4/src/net/hypki/USOS4/Main.java b/02_UsosMockup4/src/net/hypki/USOS4/Main.java new file mode 100644 index 0000000..a23c0a0 --- /dev/null +++ b/02_UsosMockup4/src/net/hypki/USOS4/Main.java @@ -0,0 +1,21 @@ +package net.hypki.USOS4; + +import net.hypki.USOS4.model.Faculty; +import net.hypki.USOS4.model.Person; +import net.hypki.USOS4.model.Student; + +public class Main { + + public static void main(String[] args) { + System.out.println("Hello"); + + Student s = new Student(); + s.setName("Jan"); + s.setSurname("Kowalski"); + System.out.println(s.toString()); + +// Person p = new Person(); + Faculty f = new Faculty(); + } + +} diff --git a/02_UsosMockup4/src/net/hypki/USOS4/model/Faculty.java b/02_UsosMockup4/src/net/hypki/USOS4/model/Faculty.java new file mode 100644 index 0000000..e0573b7 --- /dev/null +++ b/02_UsosMockup4/src/net/hypki/USOS4/model/Faculty.java @@ -0,0 +1,26 @@ +package net.hypki.USOS4.model; + +public class Faculty extends Person { + + private String department = null; + + @Override + public String toString() { + return super.toString() + + "(" + getDepartment() + ")"; + } + + public String getDepartment() { + return department; + } + + public void setDepartment(String department) { + this.department = department; + } + + @Override + public void terminate() { + // 1. dont pay anymore + // 2. switch off cards + } +} diff --git a/02_UsosMockup4/src/net/hypki/USOS4/model/Person.java b/02_UsosMockup4/src/net/hypki/USOS4/model/Person.java new file mode 100644 index 0000000..b366a4b --- /dev/null +++ b/02_UsosMockup4/src/net/hypki/USOS4/model/Person.java @@ -0,0 +1,31 @@ +package net.hypki.USOS4.model; + +public abstract class Person { + + private String name = null; + + private String surname = null; + + public abstract void terminate(); + + @Override + public String toString() { + return getName() + " " + getSurname(); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } +} diff --git a/02_UsosMockup4/src/net/hypki/USOS4/model/Student.java b/02_UsosMockup4/src/net/hypki/USOS4/model/Student.java new file mode 100644 index 0000000..b255898 --- /dev/null +++ b/02_UsosMockup4/src/net/hypki/USOS4/model/Student.java @@ -0,0 +1,24 @@ +package net.hypki.USOS4.model; + +public class Student extends Person { + + private int indexNr = 0; + + @Override + public String toString() { + return super.toString() + ", nr indeksu " + getIndexNr(); + } + + public int getIndexNr() { + return indexNr; + } + + public void setIndexNr(int indexNr) { + this.indexNr = indexNr; + } + + @Override + public void terminate() { + // 1. remove from all classes + } +}