From c3fd361ab36335d14e97815a72f1bdc3554b56f6 Mon Sep 17 00:00:00 2001
From: TayBone2305 <tayfun.alexander@gmx.de>
Date: Tue, 17 May 2022 21:49:49 +0200
Subject: [PATCH] First Draft of classes

---
 .idea/vcs.xml       |  6 ++++++
 src/Course.java     | 22 ++++++++++++++++++++++
 src/CourseType.java |  7 +++++++
 src/ExamType.java   |  7 +++++++
 src/Gender.java     |  6 ++++++
 src/Lecturer.java   | 14 ++++++++++++++
 src/Person.java     | 40 ++++++++++++++++++++++++++++++++++++++++
 src/Status.java     |  6 ++++++
 src/Student.java    | 24 ++++++++++++++++++------
 9 files changed, 126 insertions(+), 6 deletions(-)
 create mode 100644 .idea/vcs.xml
 create mode 100644 src/Course.java
 create mode 100644 src/CourseType.java
 create mode 100644 src/ExamType.java
 create mode 100644 src/Gender.java
 create mode 100644 src/Lecturer.java
 create mode 100644 src/Person.java
 create mode 100644 src/Status.java

diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>
\ No newline at end of file
diff --git a/src/Course.java b/src/Course.java
new file mode 100644
index 0000000..4cd8b47
--- /dev/null
+++ b/src/Course.java
@@ -0,0 +1,22 @@
+public class Course
+{
+    // most attributes are concrete and can't be changed easily without changing the whole system
+    final private int id;   // PK // FK
+    final private String name;
+    final private BachelorSemester bachelorSemester;
+    final private CourseType courseType;
+    final private double sws;
+    final private int ects;
+    private ExamType examType;
+
+    public Course(int id, String name, BachelorSemester bachelorSemester, CourseType courseType, double sws, int ects, ExamType examType)
+    {
+        this.id = id;
+        this.name = name;
+        this.bachelorSemester = bachelorSemester;
+        this.courseType = courseType;
+        this.sws = sws;
+        this.ects = ects;
+        this.examType = examType;
+    }
+}
diff --git a/src/CourseType.java b/src/CourseType.java
new file mode 100644
index 0000000..a65aa22
--- /dev/null
+++ b/src/CourseType.java
@@ -0,0 +1,7 @@
+public enum CourseType
+{
+    REQUIRED,
+    ELECTIVE,
+    COMPULSORY,
+    PLV,
+}
diff --git a/src/ExamType.java b/src/ExamType.java
new file mode 100644
index 0000000..f3ca07f
--- /dev/null
+++ b/src/ExamType.java
@@ -0,0 +1,7 @@
+public enum ExamType
+{
+    WRITTEN,
+    ORAL,
+    RESEARCH_PROJECT,
+    TAKE_HOME;
+}
diff --git a/src/Gender.java b/src/Gender.java
new file mode 100644
index 0000000..6cf69ee
--- /dev/null
+++ b/src/Gender.java
@@ -0,0 +1,6 @@
+public enum Gender
+{
+    MALE,
+    FEMALE,
+    OTHER;
+}
diff --git a/src/Lecturer.java b/src/Lecturer.java
new file mode 100644
index 0000000..db7a49a
--- /dev/null
+++ b/src/Lecturer.java
@@ -0,0 +1,14 @@
+public class Lecturer extends Person
+{
+    public Lecturer(int id, String firstName, String lastName, String placeOfResidence, String birthPlace,
+                    String officialEmail, String privateEmail, boolean isSignedUp, Gender gender, Status status)
+    {
+        super(id, firstName, lastName, placeOfResidence, birthPlace,
+                officialEmail, privateEmail, isSignedUp, gender, status);
+    }
+
+    public void setGrades()
+    {
+
+    }
+}
diff --git a/src/Person.java b/src/Person.java
new file mode 100644
index 0000000..4e1b1b6
--- /dev/null
+++ b/src/Person.java
@@ -0,0 +1,40 @@
+import java.util.ArrayList;
+import java.util.List;
+
+public class Person
+{
+    final private int id; // final for the ID because it will remain the same for the whole duration of studying or being employed
+    private Status status;
+    private Gender gender;
+    private String firstName;
+    private String lastName;
+    private String placeOfResidence;
+    private String birthPlace;
+    private String officialEmail;
+    private String privateEmail;
+    private List<Course> personalCourses = new ArrayList<>();
+    private boolean isSignedUp;
+
+    public Person(int id, String firstName, String lastName, String placeOfResidence, String birthPlace,
+                  String officialEmail, String privateEmail, boolean isSignedUp, Gender gender, Status status)
+    {
+        this.id = id;
+        this.firstName = firstName;
+        this.lastName = lastName;
+        this.placeOfResidence = placeOfResidence;
+        this.birthPlace = birthPlace;
+        this.officialEmail = officialEmail;
+        this.privateEmail = privateEmail;
+        this.isSignedUp = isSignedUp;
+        this.gender = gender;
+        this.status = status;
+    }
+
+    public boolean SignUpForCourse(Course course)
+    {
+        personalCourses.add(course);
+
+        // return status for registration process: was successful or has failed
+        return isSignedUp;
+    }
+}
diff --git a/src/Status.java b/src/Status.java
new file mode 100644
index 0000000..61c694c
--- /dev/null
+++ b/src/Status.java
@@ -0,0 +1,6 @@
+public enum Status
+{
+    ENROLLED,
+    ON_LEAVE,
+    EXMATRICULATED;
+}
diff --git a/src/Student.java b/src/Student.java
index c47d044..602ff3f 100644
--- a/src/Student.java
+++ b/src/Student.java
@@ -1,16 +1,28 @@
 import java.util.List;
 
-public class Student
+public class Student extends Person
 {
-    private int id;
+    // no static because variables don't make any sense without the created object
+    private boolean paidFees;
+    private List<Double> grades;
     // CourseOfStudy
+    private BachelorSemester bachelorSemester;
+    private BachelorDegree bachelorDegree;
 
-    public BachelorSemester bachelorSemester;
-    public BachelorDegree bachelorDegree;
-    private List<Double> grades;
+    public Student(int id, String firstName, String lastName, String placeOfResidence, String birthPlace,
+                   String officialEmail, String privateEmail, boolean isSignedUp, Gender gender, Status status,
+                   boolean paidFess, List<Double> grades, BachelorSemester bachelorSemester, BachelorDegree bachelorDegree)
+    {
+        super(id, firstName, lastName, placeOfResidence, birthPlace,
+                officialEmail, privateEmail, isSignedUp, gender, status);
+        this.paidFees = paidFess;
+        this.grades = grades;
+        this.bachelorSemester = bachelorSemester;
+        this.bachelorDegree = bachelorDegree;
+    }
 
     public List<Double> GetGrades()
     {
-       return grades;
+        return grades;
     }
 }
\ No newline at end of file
-- 
GitLab