java选课系统_java实现学生选课系统

本文介绍了使用Java编程实现学生选课系统的过程,包括学生、老师和课程类的设计,如添加、移除课程等操作。提供了具体的代码示例,帮助读者理解如何构建这样一个系统。
摘要由CSDN通过智能技术生成

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

案例要求:

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

老师(工号,姓名,所教课程{<3})

课程(课程号,课程名,学分,教师,已选课学生{<30})

选课系统代码如下:

//teacher

public class teacher {

private int id;

private string teachername;

private course[] courses;

//构造函数

public teacher() {

super();

courses= new course[3];

}

public teacher(int id,string teachername){

this.id=id;

this.teachername=teachername;

courses = new course[3];

}

//修改或是添加属性

public int getid() {

return id;

}

public void setid(int id) {

this.id = id;

}

public string getteachername() {

return teachername;

}

public void setteachername(string teachername) {

this.teachername = teachername;

}

}

/**

* 课程

*/

public class course {

private string coursename;

private int courseid;

private teacher teacher;

private float credit;

private student[] students;

//构造函数

public course(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];

}

public course(int courseid,string coursename,float credit) {

super();

this.courseid=courseid;

this.coursen

  • 2
    点赞
  • 32
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值