Java做一个学生选课系统
代码:
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class StudentCourseSystem {
public static void main(String[] args) {
List<String> courses = new ArrayList<>();
List<String> selectedCourses = new ArrayList<>();
courses.add("Java编程");
courses.add("数据库管理");
courses.add("数据结构");
Scanner scanner = new Scanner(System.in);
while (true) {
System.out.println("1. 选课");
System.out.println("2. 退课");
System.out.println("3. 查询已选课程");
System.out.println("4. 退出系统");
System.out.print("请输入您的选择: ");
int choice = scanner.nextInt();
switch (choice) {
case 1:
System.out.println(