Add: a4 test cases
This commit is contained in:
12
assignment4/Question1/StartGrading.java
Normal file
12
assignment4/Question1/StartGrading.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
public class StartGrading {
|
||||||
|
public static void testCourse()
|
||||||
|
{
|
||||||
|
// Since we cannot create any Course object,
|
||||||
|
//the testCourse method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
testCourse();
|
||||||
|
}
|
||||||
|
}
|
||||||
17
assignment4/Question2/StartGrading.java
Normal file
17
assignment4/Question2/StartGrading.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
public class StartGrading {
|
||||||
|
public static void testCourse()
|
||||||
|
{
|
||||||
|
// Since we cannot create any Course object,
|
||||||
|
//the testCourse method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
public static void testMajorRequired()
|
||||||
|
{
|
||||||
|
//Since we cannot create any MajorRequired object,
|
||||||
|
//the testMajorRequired method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
testCourse();
|
||||||
|
testMajorRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
26
assignment4/Question3/StartGrading.java
Normal file
26
assignment4/Question3/StartGrading.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
public class StartGrading {
|
||||||
|
public static void testCourse()
|
||||||
|
{
|
||||||
|
// Since we cannot create any Course object,
|
||||||
|
//the testCourse method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testMajorRequired()
|
||||||
|
{
|
||||||
|
//Since we cannot create any MajorRequired object,
|
||||||
|
//the testMajorRequired method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testMajorElective()
|
||||||
|
{
|
||||||
|
//Since we cannot create any MajorElective object,
|
||||||
|
//the testMajorElective method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
testCourse();
|
||||||
|
testMajorElective();
|
||||||
|
testMajorRequired();
|
||||||
|
}
|
||||||
|
}
|
||||||
38
assignment4/Question4/StartGrading.java
Normal file
38
assignment4/Question4/StartGrading.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
public class StartGrading {
|
||||||
|
public static void testCourse()
|
||||||
|
{
|
||||||
|
// Since we cannot create any Course object,
|
||||||
|
//the testCourse method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testMajorRequired()
|
||||||
|
{
|
||||||
|
//Since we cannot create any MajorRequired object,
|
||||||
|
//the testMajorRequired method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testMajorElective()
|
||||||
|
{
|
||||||
|
//Since we cannot create any MajorElective object,
|
||||||
|
//the testMajorElective method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testBase()
|
||||||
|
{
|
||||||
|
Base b = new Base("DS1001", "EntryCourse");
|
||||||
|
System.out.println(b.getCode() == "DS1001");
|
||||||
|
System.out.println(b.getTitle() == "EntryCourse");
|
||||||
|
System.out.println(b.getPreRequisite() == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
testCourse();
|
||||||
|
testMajorElective();
|
||||||
|
testMajorRequired();
|
||||||
|
testBase();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
64
assignment4/Question5/StartGrading.java
Normal file
64
assignment4/Question5/StartGrading.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
public class StartGrading {
|
||||||
|
public static void testCourse()
|
||||||
|
{ //Since we cannot create any Course object,
|
||||||
|
//the testAnimal method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testMajorRequired()
|
||||||
|
{
|
||||||
|
//create a Base object
|
||||||
|
Base b = new Base("DS1001","EntryCourse");
|
||||||
|
//create a first MajorRequired object with the base course as pre-requisite
|
||||||
|
MajorRequired mr1 = new MajorRequired("DS200X","OOP",b);
|
||||||
|
//create a second MajorRequired object with the first major required course as pre-requisite
|
||||||
|
MajorRequired mr2 = new MajorRequired("DS300X","Data Mining",mr1);
|
||||||
|
|
||||||
|
//test mr1
|
||||||
|
System.out.println(mr1.getCode()=="DS200X");
|
||||||
|
System.out.println(mr1.getTitle()=="OOP");
|
||||||
|
System.out.println(mr1.getPreRequisite() == b);
|
||||||
|
|
||||||
|
//test mr2
|
||||||
|
System.out.println(mr2.getCode()=="DS300X");
|
||||||
|
System.out.println(mr2.getTitle()=="Data Mining");
|
||||||
|
System.out.println(mr2.getPreRequisite() == mr1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testMajorElective()
|
||||||
|
{
|
||||||
|
//create a Base object
|
||||||
|
Base b = new Base("DS1001","EntryCourse");
|
||||||
|
//create a first MajorRequired object with the base course as pre-requisite
|
||||||
|
MajorRequired mr1 = new MajorRequired("DS200X","OOP",b);
|
||||||
|
//create a MajorElective object with the major required course as pre-requisite
|
||||||
|
MajorElective me1 = new MajorElective("DS300X","Data Mining",mr1);
|
||||||
|
|
||||||
|
//test mr1
|
||||||
|
System.out.println(mr1.getCode()=="DS200X");
|
||||||
|
System.out.println(mr1.getTitle()=="OOP");
|
||||||
|
System.out.println(mr1.getPreRequisite() == b);
|
||||||
|
|
||||||
|
//test mr2
|
||||||
|
System.out.println(me1.getCode()=="DS300X");
|
||||||
|
System.out.println(me1.getTitle()=="Data Mining");
|
||||||
|
System.out.println(me1.getPreRequisite() == mr1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testBase()
|
||||||
|
{
|
||||||
|
Base b = new Base("DS1001", "EntryCourse");
|
||||||
|
System.out.println(b.getCode() == "DS1001");
|
||||||
|
System.out.println(b.getTitle() == "EntryCourse");
|
||||||
|
//System.out.println(b.isRequired() == true);
|
||||||
|
System.out.println(b.getPreRequisite() == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
testCourse();
|
||||||
|
testBase();
|
||||||
|
testMajorRequired();
|
||||||
|
testMajorElective();
|
||||||
|
}
|
||||||
|
}
|
||||||
76
assignment4/Question6/StartGrading.java
Normal file
76
assignment4/Question6/StartGrading.java
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
public class StartGrading {
|
||||||
|
public static void testCourse()
|
||||||
|
{ //Since we cannot create any Course object,
|
||||||
|
//the testAnimal method of the Course class must be empty.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testMajorRequired()
|
||||||
|
{
|
||||||
|
//create a Base object
|
||||||
|
Base b = new Base("DS1001","EntryCourse");
|
||||||
|
//create a first MajorRequired object with the base course as pre-requisite
|
||||||
|
MajorRequired mr1 = new MajorRequired("DS200X","OOP",b);
|
||||||
|
//create a second MajorRequired object with the first major required course as pre-requisite
|
||||||
|
MajorRequired mr2 = new MajorRequired("DS300X","Data Mining",mr1);
|
||||||
|
|
||||||
|
//test mr1
|
||||||
|
System.out.println(mr1.getCode()=="DS200X");
|
||||||
|
System.out.println(mr1.getTitle()=="OOP");
|
||||||
|
System.out.println(mr1.getPreRequisite() == b);
|
||||||
|
|
||||||
|
//test mr2
|
||||||
|
System.out.println(mr2.getCode()=="DS300X");
|
||||||
|
System.out.println(mr2.getTitle()=="Data Mining");
|
||||||
|
System.out.println(mr2.getPreRequisite() == mr1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testMajorElective()
|
||||||
|
{
|
||||||
|
//create a Base object
|
||||||
|
Base b = new Base("DS1001","EntryCourse");
|
||||||
|
//create a first MajorRequired object with the base course as pre-requisite
|
||||||
|
MajorRequired mr1 = new MajorRequired("DS200X","OOP",b);
|
||||||
|
//create a MajorElective object with the major required course as pre-requisite
|
||||||
|
MajorElective me1 = new MajorElective("DS300X","Data Mining",mr1);
|
||||||
|
|
||||||
|
//test mr1
|
||||||
|
System.out.println(mr1.getCode()=="DS200X");
|
||||||
|
System.out.println(mr1.getTitle()=="OOP");
|
||||||
|
System.out.println(mr1.getPreRequisite() == b);
|
||||||
|
|
||||||
|
//test mr2
|
||||||
|
System.out.println(me1.getCode()=="DS300X");
|
||||||
|
System.out.println(me1.getTitle()=="Data Mining");
|
||||||
|
System.out.println(me1.getPreRequisite() == mr1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testBase()
|
||||||
|
{
|
||||||
|
Base b = new Base("DS1001", "EntryCourse");
|
||||||
|
System.out.println(b.getCode() == "DS1001");
|
||||||
|
System.out.println(b.getTitle() == "EntryCourse");
|
||||||
|
//System.out.println(b.isRequired() == true);
|
||||||
|
System.out.println(b.getPreRequisite() == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void testManyCourses()
|
||||||
|
{
|
||||||
|
Base b = new Base("DS1001","EntryCourse");
|
||||||
|
MajorRequired mr1 = new MajorRequired("DS200X","OOP",b);
|
||||||
|
MajorElective me1 = new MajorElective("DS300X","Data Mining",mr1);
|
||||||
|
ManyCourses mc = new ManyCourses();
|
||||||
|
mc.addCourse(b);
|
||||||
|
mc.addCourse(mr1);
|
||||||
|
mc.addCourse(me1);
|
||||||
|
mc.listCourses();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args)
|
||||||
|
{
|
||||||
|
testCourse();
|
||||||
|
testBase();
|
||||||
|
testMajorRequired();
|
||||||
|
testMajorElective();
|
||||||
|
testManyCourses();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user