This commit is contained in:
2022-04-21 15:43:38 +08:00
parent 8bb5c66d2c
commit 941b3d26d4
27 changed files with 1525 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
/*
* Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007)
* Date: 2022-04-18
* Description: This is the Base Class.
*/
public class Base {
private String code;
private String title;
/**
* Constructor
*
* @param code The code of the course
* @param title The title of the course
*/
public Base(String code, String title) {
this.code = code;
this.title = title;
}
/**
* Getter of code
*
* @return The code of the course
*/
public String getCode() {
return code;
}
/**
* Getter of title
*
* @return The title of the course
*/
public String getTitle() {
return title;
}
/**
* Get the pre-requisite course. It will return itself.
*
* @return this
*/
public Base getPreRequisite() {
return this;
}
/**
* Test.
*/
public static void testBase() {
Base base = new Base("COMP3013", "Database Management System");
System.out.println(base.getCode() == "COMP3013");
System.out.println(base.getTitle() == "Database Management System");
System.out.println(base.getPreRequisite() == base);
}
}