parent
3e3db11e3c
commit
0f1d102773
@ -0,0 +1,45 @@
|
||||
// 学生视图类 - View层
|
||||
import java.util.List;
|
||||
|
||||
public class StudentView {
|
||||
// 显示所有学生信息
|
||||
public void displayAllStudents(List<Student> students) {
|
||||
System.out.println("\n===== 学生列表 =====");
|
||||
if (students.isEmpty()) {
|
||||
System.out.println("当前没有学生信息");
|
||||
} else {
|
||||
for (Student student : students) {
|
||||
System.out.println(student);
|
||||
}
|
||||
}
|
||||
System.out.println("====================\n");
|
||||
}
|
||||
|
||||
// 显示单个学生信息
|
||||
public void displayStudent(Student student) {
|
||||
System.out.println("\n===== 学生详情 =====");
|
||||
if (student != null) {
|
||||
System.out.println(student);
|
||||
} else {
|
||||
System.out.println("未找到该学生信息");
|
||||
}
|
||||
System.out.println("====================\n");
|
||||
}
|
||||
|
||||
// 显示操作结果
|
||||
public void displayMessage(String message) {
|
||||
System.out.println("[提示] " + message);
|
||||
}
|
||||
|
||||
// 显示菜单
|
||||
public void displayMenu() {
|
||||
System.out.println("===== 学生管理系统 =====");
|
||||
System.out.println("1. 添加学生");
|
||||
System.out.println("2. 删除学生");
|
||||
System.out.println("3. 修改学生信息");
|
||||
System.out.println("4. 查询学生");
|
||||
System.out.println("5. 显示所有学生");
|
||||
System.out.println("6. 退出系统");
|
||||
System.out.print("请选择操作 (1-6): ");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue