Main.java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("\t\t简易教务管理系统");
System.out.println("1、录入学生\t2、显示学生\t3、录入课程\t4、显示课程\t5、录入教师"
+"\t6、显示教师\t7、学生选课\t8、教师录入成绩\t9、教师排课\t10、授课评价\t0、退出");
Student[] students=null;
Course courses[]=null;
Teacher teachers[]=null;
Operator operator=new Operator();
Scanner scan= new Scanner(System.in);
itcase: while (true) {
//显示系统主菜单
System.out.print("请选择功能菜单:");
int choice = scan.nextInt();// 接收用户的选择
switch(choice){
case 1: // 输入学生信息
System.out.println("请输入学生数:");
int n = scan.nextInt();
students = new Student[n];
operator.addStudents(students);
break;
case 2: // 显示全部学生信息
operator.displayStudents(students);
break;
case 3://录入课程
System.out.println("请输入课程数:");
n = scan.nextInt();
courses = new Course[n];
operator.addCourses(courses);
break;
case 4: // 显示课程
operator.displayCourses(courses);
break;
case 5: // 录入教师
System.out.println("请输入教师数:");
n = scan.nextInt();
teachers = new Teacher[n];
operator.addTeachers(teachers);
break;
case 6:// 显示教师
operator.displayTeachers(teachers);
break;
case 7:// 学生选课
operator.stuSelectCourses(students, courses);
break;
case 8:// 录入成绩
operator.inputScores(students);
break;
case 9:// 教师排课
operator.assignTeachCourses(teachers, courses);
break;
case 10:// 授课评价
operator.inputEvaluate(teachers);
break;
case 0:// 退出
break itcase;
default:
System.out.println("非法命令!");
}
}
}
Course.java
public class Course {
private String courseId;//课程号
private String courseName;//课程名称
private double credit;//学分
//构造方法
Course(){
}
Course(String courseId,String courseName,double credit){
this.setCourseId(courseId);
this.setCourseName(courseName);
this.setCredit(credit);
}
public String getCourseId() {
return courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getCourseName() {
return courseName;
}
public void setCourseName(String courseName) {
this.courseName = courseName;
}
public double getCredit() {
return credit;
}
public void setCredit(double credit) {
this.credit = credit;
}
}
Operator.java
import java.util.Scanner;
public class Operator {
Scanner scan;
Operator(){
scan= new Scanner(System.in);
}
//录入课程
public void addCourses(Course[] courses){
System.out.println("请输入学生信息:格式为课程号,课程名,学分");
String str;
String sInfor[];
for(int i=0;i
Student.java
public class Student {
//设置Student类的属性
private String stuId; //学号
private String stuName; //姓名
private String sex; //性别
private String tel; //电话号码
private String address; //地址
private int age; //年龄
SelectCourse[] selCourse; //选修课程
//构造方法
Student(){
}
Student(String stuId,String stuName){
this.stuId=stuId;
this.stuName=stuName;
}
Student(String stuId,String stuName,String sex,String tel,String address,int age){
this(stuId,stuName); //this的用法
this.sex=sex;
this.tel=tel;
this.address=address; //地址
this.age=age;
}
public String getStuId() {
return stuId;
}
public void setStuId(String stuId) {
this.stuId = stuId;
}
//姓名属性封装
public String getStuName() {
return stuName;
}
public void setStuName(String stuName) {
this.stuName = stuName;
}
//性别属性封装
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
//电话属性封装
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
//地址属性封装
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
//年龄属性封装
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
//设置选修课程
public void setSelCourse(String[] cIds) { //cIds课程号数组 001,002
selCourse=new SelectCourse[cIds.length];
for(int j=0;j
Teacher.java
public class Teacher {
//设置Teacher类的属性
private String teaId; //工号
private String teaName; //姓名
private String sex; //性别
private String tel; //电话
private String professor; //职称
private int age; //年龄
TeachCourse teachCourse[]; //所授课程
//构造方法
Teacher(){
}
Teacher(String teaId,String teaName){
this.teaId=teaId;
this.teaName=teaName;
}
Teacher(String teaId,String teaName,String sex,String tel,String professor,int age){
this(teaId,teaName); //this的用法
this.sex=sex;
this.tel=tel;
this.professor=professor; //地址
this.age=age;
}
//工号属性封装
public String getTeaId() {
return teaId;
}
public void setTeaId(String teaId) {
this.teaId = teaId;
}
//姓名属性封装
public String getTeaName() {
return teaName;
}
public void setTeaName(String teaName) {
this.teaName = teaName;
}
//性别属性封装
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
//电话属性封装
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
//职称属性封装
public String getProfessor() {
return professor;
}
public void setProfessor(String professor) {
this.professor = professor;
}
//年龄属性封装
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
//所授课程设置
public void setTeachCourse(String[] cIds) {
teachCourse=new TeachCourse[cIds.length];
for(int j=0;j
01,张三,男,13500043567,浙江杭州,21
02,李四,男,13099872371,浙江温州,21
03,王五,男,13790972431,浙江金华,21
04,赵六,女,13190345445,浙江台州,21
05,孙七,女,13943298712,浙江湖州,21
001,Java编程,6
002,网页设计,3.5
003,AppInventor,2
01,李老师,男,13500043567,讲师,39
02,杨老师,女,13099872371,讲师,38
03,高老师,女,13790972431,副教授,39
04,赵老师,男,13190345445,副教授,56
05,孙老师,女,13943298712,教授,47