Prerequisities List,对应列表

时间:2016-04-16 12:24:53

标签: java collections

我正在开展学生注册系统项目(没有GUI)。

我有以下实体:教师,学生,课程,ConsentRequest,学期,部分和人

学期课程

package registrationsystem;

import java.util.ArrayList;

public class Semester {
    public static void main(String[] args) {

    ArrayList<Students> students = new ArrayList<Students>(5);
    ArrayList<Course> courses = new ArrayList<Course>(5);
    ArrayList<Instructors> instructors = new ArrayList<Instructors>(5);
    ArrayList<Sections> sections = new ArrayList<Sections>(5);
    String [][] prerequisities={{"MIS132","MIS131"},{"TRM256","TRM201"}};
    String [][] corresponding={{"TRM256","MIS132"},{"TRM101","MIS131"}};



    double [][] CourseTaken=new double[20][20];
    double [][] InstructorSections=new double[20][20];

    Students s1=new Students("Ahmet");
    Students s2=new Students("Onur");
    Students s3=new Students("Veli");
    Students s4=new Students("Orhan");


    students.add(s1);
    students.add(s2);
    students.add(s3);
    students.add(s4);



    Instructors i1=new Instructors("Jack","Dr");
    Instructors i2=new Instructors("Onur","Prof");
    Instructors i3=new Instructors("Veli","Dr");
    Instructors i4=new Instructors("Orhan","Prof");

    //HERE Course c1=new Course("IntroductiontoJavaProgramming",3,"MIS131",prerequisities[0][0],corresponding[0][0]); //*HERE
    Course c2=new Course("ObjectOriented",4,"MIS132");
    Course c3=new Course("CommunicationBasis",3,"TRM101");
    Course c4=new Course("BusinessCommunication",3,"TRM256");

    Sections se1=new Sections(15,i1,"MIS132.01",4,"MIS132");
    Sections se2=new Sections(20,i2,"MIS132.02",4,"MIS132");
    Sections se3=new Sections(16,i4,"TRM256.02",3,"TRM256");
    Sections se4=new Sections(19,i3,"MIS 131.01",3,"MIS131");
    Sections se5=new Sections(35,i4,"TRM101.01",3,"TRM101");




}
}

每个学生都修读一门课程,但学生有义务在获准参加课程之前必须通过必修课。或者他需要参加相应的课程。

例如,如果学生想要参加MIS132课程,首先他必须参加MIS131课程,因为这是必修课程或CMP15课程,因为它是MIS131的相应课程。

所以我的问题是如何将课程类放入先决条件列表和相应的列表,然后在主类中,我可以使用参数调用此方法。我写了这里&#39; HERE&#39;在代码中

Courses.java

package registrationsystem;
import java.util.*;
public class Course {

    private String name;
    private int credit;
    private String code;
    String[][] prerequisitelist = new String[5][5];
    String[][] correspondinglist=new String[5][5];


    protected Course(String name,int credit,String code,String[][] prerequisitelist,String[][] correspondinglist){
        this.name=name;
        this.credit=credit;
        this.code=code;
        this.prerequisitelist=prerequisitelist;
        this.correspondinglist=correspondinglist;

    }



}

0 个答案:

没有答案