java 使用gui 设计一个 求类似源码 非常感谢 交作业用的 题目十八:学生选课管理信息系统 系统功能的基本要求: (1)教师信息,包括教师编号、教师姓名、性别、年龄、学历、职称、毕业院校,健康状况等。 (2)学生信息,包括学号、姓名、所属院系、已选课情况等。教室信息,包括,可容纳人数、空闲时间等。 (3)选课信息,包括课程编号、课程名称、任课教师、选课的学生情况等。 (4)成绩信息,包括课程编号、课程名称、学分、成绩。 (5)按一定条件可以查询,并将结果打印输出。 学生, 信息
悬赏就不需要了。 根据之前帮别人做的项目,跟你这个雷同,根据你要求简单修改了代码,希望帮到你 [Java] 纯文本查看 复制代码import java.util.ArrayList; import java.util.List; import java.util.Scanner; class Teacher { private String id; private String name; private String gender; private int age; private String education; private String title; private String graduation; private String health; public Teacher(String id, String name, String gender, int age, String education, String title, String graduation, String health) { this.id = id; this.name = name; this.gender = gender; this.age = age; this.education = education; this.title = title; this.graduation = graduation; this.health = health; } // Getters and Setters // ... @Override public String toString() { return "Teacher{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", gender='" + gender + '\'' + ", age=" + age + ", education='" + education + '\'' + ", title='" + title + '\'' + ", graduation='" + graduation + '\'' + ", health='" + health + '\'' + '}'; } } class Student { private String id; private String name; private String department; private List selectedCourses; public Student(String id, String name, String department) { this.id = id; this.name = name; this.department = department; this.selectedCourses = new ArrayList(); } // Getters and Setters // ... public void addCourse(String courseId) { selectedCourses.add(courseId); } public void removeCourse(String courseId) { selectedCourses.remove(courseId); } @Override public String toString() { return "Student{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", department='" + department + '\'' + ", selectedCourses=" + selectedCourses + '}'; } } class Course { private String id; private String name; private String teacherId; private List enrolledStudents; public Course(String id, String name, String teacherId) { this.id = id; this.name = name; this.teacherId = teacherId; this.enrolledStudents = new ArrayList(); } // Getters and Setters // ... public void enrollStudent(String studentId) { enrolledStudents.add(studentId); } public void removeStudent(String studentId) { enrolledStudents.remove(studentId); } @Override public String toString() { return "Course{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", teacherId='" + teacherId + '\'' + ", enrolledStudents=" + enrolledStudents + '}'; } } class Grade { private String courseId; private String courseName; private int credits; private double score; public Grade(String courseId, String courseName, int credits, double score) { this.courseId = courseId; this.courseName = courseName; this.credits = credits; this.score = score; } // Getters and Setters // ... @Override public String toString() { return "Grade{" + "courseId='" + courseId + '\'' + ", courseName='" + courseName + '\'' + ", credits=" + credits + ", score=" + score + '}'; } } public class CourseManagementSystem { private List teachers; private List students; private List courses; private List grades; public CourseManagementSystem() { teachers = new ArrayList(); students = new ArrayList(); courses = new ArrayList(); grades = new ArrayList(); } public void addTeacher(Teacher teacher) { teachers.add(teacher); } public void addStudent(Student student) { students.add(student); } public void addCourse(Course course) { courses.add(course); } public void addGrade(Grade grade) { grades.add(grade); } public void printTeachers() { System.out.println("Teachers:"); for (Teacher teacher : teachers) { System.out.println(teacher); } System.out.println(); } public void printStudents() { System.out.println("Students:"); for (Student student : students) { System.out.println(student); } System.out.println(); } public void printCourses() { System.out.println("Courses:"); for (Course course : courses) { System.out.println(course); } System.out.println(); } public void printGrades() { System.out.println("Grades:"); for (Grade grade : grades) { System.out.println(grade); } System.out.println(); } // Other methods for querying and managing data // ... public static void main(String[] args) { CourseManagementSystem system = new CourseManagementSystem(); // Add sample data Teacher teacher1 = new Teacher("T001", "John Smith", "Male", 35, "Ph.D.", "Professor", "ABC University", "Good"); Teacher teacher2 = new Teacher("T002", "Jane Doe", "Female", 40, "Masters", "Associate Professor", "XYZ University", "Excellent"); system.addTeacher(teacher1); system.addTeacher(teacher2); Student student1 = new Student("S001", "Alice Johnson", "Computer Science"); Student student2 = new Student("S002", "Bob Williams", "Electrical Engineering"); system.addStudent(student1); system.addStudent(student2); Course course1 = new Course("C001", "Java Programming", "T001"); Course course2 = new Course("C002", "Database Management", "T002"); system.addCourse(course1); system.addCourse(course2); Grade grade1 = new Grade("C001", "Java Programming", 4, 85.0); Grade grade2 = new Grade("C002", "Database Management", 3, 90.5); system.addGrade(grade1); system.addGrade(grade2); // Print data system.printTeachers(); system.printStudents(); system.printCourses(); system.printGrades(); } }