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

First Draft of classes

parent 444bb65b
No related branches found
No related tags found
2 merge requests!4Deleted .idea/.gitignore, .idea/dbnavigator.xml, .idea/misc.xml,...,!3jpa+gui+logic
<?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
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;
}
}
public enum CourseType
{
REQUIRED,
ELECTIVE,
COMPULSORY,
PLV,
}
public enum ExamType
{
WRITTEN,
ORAL,
RESEARCH_PROJECT,
TAKE_HOME;
}
public enum Gender
{
MALE,
FEMALE,
OTHER;
}
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()
{
}
}
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;
}
}
public enum Status
{
ENROLLED,
ON_LEAVE,
EXMATRICULATED;
}
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
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