course.java~4~

来自「学生成绩管理系统」· JAVA~4~ 代码 · 共 53 行

JAVA~4~
53
字号
package teamwork;

/**
 * <p>Title: teamwork</p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2007</p>
 *
 * <p>Company: </p>
 *
 * @author yeliang
 * @version 1.0
 */
public class course {

    String[] sub = new String[10];
    int[] sub_mark = new int[10];
    int num;//某一学期课程数量

    public course() {
        num = 0;
        for(int i=0;i<10;i++) sub[i] = null;
        for(int i=0;i<10;i++) sub_mark[i] = 0;
    }

    public void delete(String coursename){
        int i = 0;
        int n = 0;

        for(i=0;i<num;i++)
            if(this.sub[i].equals(coursename))
                for(int j=i;j<num;j++){
                    this.sub[j] = this.sub[j+1];
                    this.sub_mark[j] = this.sub_mark[j+1];
                    n++;
                    //this.num = this.num - 1;
                }

        this.num = this.num - n;
    }

    public void add(String coursename,int mark){
        this.sub[num] = coursename;
        this.sub_mark[num] = mark;
        this.num = this.num + 1;
    }

    public static void main(String[] args) {
        //course course = new course();
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?