所以我有一个数据结构课程的作业,我已经尝试尽可能多地做,但我目前被困在作业的这一部分,我需要一些帮助。作业基本上需要你制作一个java程序,它是一个学生记录数据库,使用链表存储6个变量:id、name、subCode、subName、sem和year。这是我迄今为止所做的。主要类:import java.util.*;public class Main {public int id =0;public String name= "";public String subCode="";public String subName="";public String sem;public int year;LinkedList list = new LinkedList();Scanner scan = new Scanner(System.in);public void Menu() { boolean valid = true; while (valid) { final String menu[] = {"Main Menu", "1. Register student's subjects", "2. Retrieve all students' subjects listing", "3. Retrieve a student's subjects listing", "4. Update a student's registered subjects", "5. Delete a student's registered subjects", "6. Delete a student registration", "7. Exit"}; for (String menuList : menu) System.out.println(menuList); switch (scan.nextInt()) { case 1: create(); break; case 2: list.retrieveAll(); break; case 3: //retrieveOne(); break; case 4: //update(); break; case 5: //deleteSub(); break; case 6: deleteStud(); break; case 7: System.out.println("Have a nice day!"); valid = false; break; default: System.out.println("You have not entered a valid option"); break; } } }
添加回答
举报
0/150
提交
取消