/* * Author: CHEN Yongyuan (Walter) 1930006025 from OOP(1007) * Date: 2022-04-18 * Description: This is the Base Class. */ public class Base implements Learnable { 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 Learnable 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); } }