This commit is contained in:
ldy
2026-03-01 23:18:55 -05:00
commit 67f753a5d1
3087 changed files with 218259 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Question3</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8

View File

@@ -0,0 +1,34 @@
public abstract class Course {
//instance variables
private String code;
private String title;
private Course preRequisite;
//constructor
public Course(String code, String title, Course preRequisite) {
if(preRequisite != null) {
this.code = code;
this.title = title;
this.preRequisite = preRequisite;
}
else {
System.out.println("pre-requisite course cannot null!");
return;
}
}
//methods
public String getCode() {return this.code;}
public String getTitle() {return this.title;}
public Course getPreRequisite() {return this.preRequisite;}
public abstract boolean isRequired();
//test
public static void testCourse() {
// Since we cannot create any Course object, the testCourse method of the Course class must be empty.
}
}

View File

@@ -0,0 +1,17 @@
public class MajorElective extends Course{
//constructor
public MajorElective(String code, String title, MajorRequired preRequisite) {
super(code, title, preRequisite);
}
//method
@Override
public boolean isRequired() {return true;}
//test
public static void testMajorElective() {
// Since we cannot create any MajorRequired object,
// the testMajorElective method of the Course class must be empty.
}
}

View File

@@ -0,0 +1,16 @@
public class MajorRequired extends Course{
//constructor
public MajorRequired(String code, String title, MajorRequired preRequisite) {
super(code, title, preRequisite);
}
//method
@Override
public boolean isRequired() {return true;}
//test
public static void testMajorRequired() {
// Since we cannot create any MajorRequired object, the testMajorRequired method of the Course class must be empty.
}
}

View File

@@ -0,0 +1,8 @@
public class Start {
public static void main(String[] args) {
Course.testCourse();
MajorRequired.testMajorRequired();
MajorElective.testMajorElective();
}
}