Restore
This commit is contained in:
@@ -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>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Question1</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>
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,37 @@
|
||||
|
||||
public abstract class Course {
|
||||
//the Course class should be abstract as it contains abstract method
|
||||
|
||||
//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;}
|
||||
|
||||
//isRequired() should be abstract as the course are undefined
|
||||
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.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
public class Start {
|
||||
public static void main(String[] args) {
|
||||
Course.testCourse();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user