首页 > 编程知识 正文

学生选课管理系统java,java学生选课系统课程设计报告

时间:2023-05-06 00:04:50 阅读:140942 作者:1017

本文为大家分享java实现学生选课系统的具体代码,供大家参考,具体内容如下

案例要求:

学生(学号、姓名、专业、所选课程({3} )

老师(工作号码、姓名、所教课程) ({3}

课程(课程编号、课程名称、学分、教师、所选学生(() ) ) ) ) )。

选择系统代码如下。

//teacher

公共类检查器{

私有int id;

私有字符串技术;

private Course[] courses;

//构造函数

公共技术

super (;

courses=new Course[3];

}

公共技术(intid,String teacherName ) {

this.id=id;

this.teacherName=teacherName;

courses=new Course[3];

}

//修改或添加属性

公共获取

返回id;

}

公共void setid (intid ) {

this.id=id;

}

公共字符串获取技术(

返回技术;

}

publicvoidsetteachername (字符串技术)。

this.teacherName=teacherName;

}

}

//*

*路线

*/

public class Course {

private String courseName;

私有密码;

private Teacher teacher;

私有浮动创作;

private Student[] students;

//构造函数

公共成本(int courseid,String courseName,float credit,Teacher teacher ) {

super (;

this.courseId=courseId;

this.courseName=courseName;

this.credit=credit;

this.setteacher(teacher );

students=new Student[30];

}

公共成本(int courseid,String courseName,float credit ) {

super (;

this.courseId=courseId;

this.courseName=courseName;

this.credit=credit;

students=new Student[30];

}

公共计数(int courseid,String courseName ) {

super (;

this.courseId=courseId;

this.courseName=courseName;

students=new Student[30];

}

public Course ()//默认格式,以防万一

super (;

students=new Student[30];

}

//修改或获取属性值id、name、credit,

公共void setid (intid ) {

this.courseId=id;

}

公共获取

return this.courseId;

}

公共void set name (string name ) {

this.courseName=name;

}

公共字符串获取名称

return this.courseName;

}

公共声明(浮动声明) {

this.credit=credit;

}

公共浮动获取创建

return this.credit;

}

公共获取器

返回检查器;

}

publicvoidsetteacher (teacher teacher ) {

this.teacher=teacher;

}

//让学生上课

publicbooleanaddstudent { students tu }

布尔标志=假; //标志值:加入成功吗

如果学生没有选修过这门课,同时上课的学生还没满,就实行

if (! isselectedstudent(stu ) is null student (stu ) }

for(intI=0; I

//*

*学生代码

* @author Floris0811

*/

公共类student {

私有字符串名称;

私有输入;

私有字符串合并器;

private Course[] courses;

//构造函数

public Student ()//别忘了

super (;

courses=new Course[3];

}

公共student (int stuid,String stuName ) {

super (;

this.stuId=stuId;

this.stuName=stuName;

courses=new Course[3];

}

publicstudent(intstuid,String stuName,String major )。

super (;

this.stuId=stuId;

this.stuName=stuName;

this.major=major;

courses=new Course[3];

}

//修改获取属性name、id、major

公共字符串获取语句

返回样式;

}

publicvoidsetstuname (字符串名称)。

this.stuName=stuName;

}

公共获取套件

返回stuid;

}

publicvoidsetstuid(intstuid ) {

this.stuId=stuId;

}

公共字符串获取镜像

return major;

}

publicvoidsetmajor (字符串映射)。

this.major=major;

}

//学生选课

publicbooleanaddcourse (course course ) {

布尔标志=假;

if (! isselectedcourse(course ) is null course (course ) }{

for(intI=0; I

包测试;

公共类choosecoursebystu {

//*

选修课管理系统

*/

publicstaticvoidmain (string [ ] args ) {

sudentstu0=newstudent(1001,' xddz ';

studentstu1=newstudent(1002,' Eilly ';

studentstu2=newstudent(1003,' Floris ';

sudentstu3=newstudent(1004,' HaHa ';

coursecour0=newcourse(001,'高数');

coursecour1=newcourse(002,'线代');

coursecour2=newcourse(003,“概率论”);

stu0.addcourse(cour0;

stu0.addcourse(cour2;

stu0.addcourse(cour1;

stu1.addcourse(cour2;

stu1.addcourse(cour0);

stu2.addcourse(cour1;

stu3.addcourse(cour0;

stu3.addcourse(cour1;

su1.removecourse(cour2);

stu0.displayCourse (;

cour0.removestudent(stu1;

cour1.displayStudent (;

}

}

有关管理系统的详细信息,请单击《管理系统专题》学习

以上是本文的全部内容,希望对大家的学习有帮助。 另外,我希望你能多多支持编剧。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。