Skip to content
Snippets Groups Projects
Commit ff7e793a authored by TayBone2305's avatar TayBone2305
Browse files

First finished draft of database model

parent c3fd361a
No related branches found
No related tags found
1 merge request!3jpa+gui+logic
Showing
with 264 additions and 66 deletions
public enum BachelorDegree
{
BACHELOR_OF_SCIENCE,
BACHELOR_OF_ENGINEERING;
}
public enum BachelorSemester
{
FIRST,
SECOND,
THIRD,
FOURTH,
FIFTH,
SIXTH,
SEVENTH;
}
public interface Calcuable
{
double calculateAverage();
int calculateMedian();
}
import enumeration.BachelorSemester;
import enumeration.CourseType;
import enumeration.ExamType;
import enumeration.Mark;
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 final int id; // PK // FK
private final String name;
private final BachelorSemester bachelorSemester;
private final CourseType courseType;
private final int sws;
private final double ects;
private ExamType examType;
public Course(int id, String name, BachelorSemester bachelorSemester, CourseType courseType, double sws, int ects, ExamType examType)
public Course(int id, String name, BachelorSemester bachelorSemester, CourseType courseType, int sws, double ects, ExamType examType)
{
this.id = id;
this.name = name;
......@@ -19,4 +24,9 @@ public class Course
this.ects = ects;
this.examType = examType;
}
public void setGrade(Mark mark)
{
}
}
public enum CourseType
{
REQUIRED,
ELECTIVE,
COMPULSORY,
PLV,
}
import enumeration.BachelorDegree;
import enumeration.FieldOfStudy;
import java.util.List;
public class CoursesOfStudy
{
private final int id;
private final String name;
private final BachelorDegree bachelorDegree;
private final int duration;
private final int fees;
private final List<Course> courses;
private FieldOfStudy fieldOfStudy;
public CoursesOfStudy(int id, String name, BachelorDegree bachelorDegree, int duration, int fees, List<Course> courses, FieldOfStudy fieldOfStudy)
{
this.id = id;
this.name = name;
this.bachelorDegree = bachelorDegree;
this.duration = duration;
this.fees = fees;
this.courses = courses;
this.fieldOfStudy = fieldOfStudy;
}
}
public class Enrollment
{
private final int id;
private final int studentID;
private final int lecturerID;
private final int courseID;
public Enrollment(int id, int studentID, int lecturerID, int courseID)
{
this.id = id;
this.studentID = studentID;
this.lecturerID = lecturerID;
this.courseID = courseID;
}
}
public enum ExamType
{
WRITTEN,
ORAL,
RESEARCH_PROJECT,
TAKE_HOME;
}
public enum Gender
{
MALE,
FEMALE,
OTHER;
}
public class Lecturer extends Person
import enumeration.Gender;
import enumeration.Status;
import java.util.List;
public class Lecturer extends UniversityMember
{
public Lecturer(int id, String firstName, String lastName, String placeOfResidence, String birthPlace,
String officialEmail, String privateEmail, boolean isSignedUp, Gender gender, Status status)
String officialEmail, String privateEmail, List<Course> personalCourses,
boolean isSignedUpForCourse, Gender gender, Status status)
{
super(id, firstName, lastName, placeOfResidence, birthPlace,
officialEmail, privateEmail, isSignedUp, gender, status);
super(id, gender, firstName, lastName, placeOfResidence, birthPlace,
officialEmail, privateEmail, personalCourses, isSignedUpForCourse);
}
public void setGrades()
@Override
public boolean signUpForCourse(Course course)
{
return false;
}
}
public enum Status
{
ENROLLED,
ON_LEAVE,
EXMATRICULATED;
}
import enumeration.BachelorSemester;
import enumeration.Gender;
import enumeration.Status;
import java.util.List;
public class Student extends Person
public class Student extends UniversityMember implements Calcuable
{
// no static because variables don't make any sense without the created object
private Status status;
private boolean paidFees;
private List<Double> grades;
// CourseOfStudy
private BachelorSemester bachelorSemester;
private 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)
public Student(int id, Gender gender, String firstName, String lastName, String placeOfResidence, String birthPlace,
String officialEmail, String privateEmail, List<Course> personalCourses, boolean isSignedUpForCourse,
Status status, boolean paidFess, BachelorSemester bachelorSemester, List<Double> grades)
{
super(id, firstName, lastName, placeOfResidence, birthPlace,
officialEmail, privateEmail, isSignedUp, gender, status);
super(id, gender, firstName, lastName, placeOfResidence, birthPlace,
officialEmail, privateEmail, personalCourses, isSignedUpForCourse);
this.status = status;
this.paidFees = paidFess;
this.grades = grades;
this.bachelorSemester = bachelorSemester;
this.bachelorDegree = bachelorDegree;
this.grades = grades;
}
public List<Double> GetGrades()
public List<Double> getGrades()
{
return grades;
}
@Override
public boolean signUpForCourse(Course course)
{
/*
personalCourses.add(course);
// return status for registration process: was successful or has failed
return isSignedUpForCourse = true;
*/
return false;
}
@Override
public double calculateAverage()
{
return 0;
}
@Override
public int calculateMedian()
{
return 0;
}
}
\ No newline at end of file
import enumeration.Gender;
import java.util.ArrayList;
import java.util.List;
public class Person
public abstract class UniversityMember
{
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;
// final for the ID because it will remain the same for the whole duration of studying or being employed
// PK & FK
private final int id;
private Gender gender;
private String firstName;
private String lastName;
private String placeOfResidence;
private String birthPlace;
private final String birthPlace;
private String officialEmail;
private String privateEmail;
private List<Course> personalCourses = new ArrayList<>();
private boolean isSignedUp;
private boolean isSignedUpForCourse;
public Person(int id, String firstName, String lastName, String placeOfResidence, String birthPlace,
String officialEmail, String privateEmail, boolean isSignedUp, Gender gender, Status status)
public UniversityMember(int id, Gender gender, String firstName, String lastName, String placeOfResidence, String birthPlace,
String officialEmail, String privateEmail, List<Course> personalCourses, boolean isSignedUpForCourse)
{
this.id = id;
this.gender = gender;
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;
this.personalCourses = personalCourses;
this.isSignedUpForCourse = isSignedUpForCourse;
}
public boolean SignUpForCourse(Course course)
{
personalCourses.add(course);
// return status for registration process: was successful or has failed
return isSignedUp;
}
public abstract boolean signUpForCourse(Course course);
}
package enumeration;
public enum BachelorDegree
{
BACHELOR_OF_SCIENCE("B. Sc."),
BACHELOR_OF_ENGINEERING("B. Eng.");
private String degree;
private BachelorDegree(String degree)
{
this.degree = degree;
}
}
package enumeration;
public enum BachelorSemester
{
FIRST(1),
SECOND(2),
THIRD(3),
FOURTH(4),
FIFTH(5),
SIXTH(6),
SEVENTH(7);
private int semester;
private BachelorSemester(int semester)
{
this.semester = semester;
}
}
package enumeration;
public enum CourseType
{
REQUIRED("required"),
ELECTIVE("AWP"),
COMPULSORY("FWP"),
PLV("PLV");
private String courseType;
private CourseType(String courseType)
{
this.courseType = courseType;
}
}
package enumeration;
public enum ExamType
{
WRITTEN("written ex."),
RESEARCH_PROJECT("written student research project"),
BACHELOR_THESIS("bachelor thesis"),
ORAL("oral ex."),
ASSIGNMENT("assignment"),
PERFORMANCE_RECORD("TN");
private String examType;
private ExamType(String examType)
{
this.examType = examType;
}
}
package enumeration;
public enum FieldOfStudy
{
EMBEDDED_SYSTEMS,
MOBILE_AND_SPATIAL_SYSTEMS;
}
package enumeration;
public enum Gender
{
MALE("Male"),
FEMALE("Female"),
OTHER("Other");
private String gender;
private Gender(String gender)
{
this.gender = gender;
}
}
package enumeration;
public enum Mark
{
EINS_NULL(1.0),
EINS_DREI(1.3),
EINS_SIEBEN(1.7),
ZWEI_NULL(2.0),
ZWEI_DREI(2.3),
ZWEI_SIEBEN(2.7),
DREI_NULL(3.0),
DREI_DREI(3.3),
DREI_SIEBEN(3.7),
VIER_NULL(4.0),
FUENF_NULL(5.0);
private double mark;
Mark(double mark)
{
this.mark = mark;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment