Java作业:4-13.参照例4-23,利用单向链表,实现学生管理系统。解:运行图:A.主菜单B.增加学生并且打印学生信息C.删除学生信息D.修改学生信息E.查找学生信息代码实现:(1).单向链结点LinkListElement类publicclassLinkListElement{protectedObjectdata;protectedLinkListElementnextElement;publicLinkListElement(Objectv,LinkListElementnext){data=v;nextElement=next;}publicLinkListElement(Objectv){data=v;nextElement=null;}publicLinkListElementnext(){returnnextElement;}publicvoidsetNext(LinkListElementnext){nextElement=next;}publicObjectvalue(){returndata;}publicvoidsetValue(Objectvalue){data=value;}}(2).单向链表LinkList类描述publicclassLinkList{protectedintcount;protectedLinkListElementhead;publicLinkList(){head=null;count=0;}publicbooleanisEmpty(){returncount==0;}publicvoidaddToTail(Objectvalue){LinkListElementtemp=newLinkListElement(value,null);if(head!=null){LinkListElementfinger=head;while(finger.next()!=null){finger=finger.next();}finger.setNext(temp);}elsehead=temp;count++;}publicObjectremove(Objectvalue){LinkListElementfinger=head;LinkListElementprevious=null;while(finger!=null&&!finger.value().equals(value)){previous=finger;finger=finger.next();}if(finger!=null){if(previous==null){head=finger.next();}else{previous.setNext(finger.next());}count--;returnfinger.value();}returnnull;}}(3).封装好的学生类importjava.io.*;publicclassStudent{publicStringid;publicStringname;publicStringgrade;publicStringsclass;publicStringqq;publicstaticInputStreamReaderisr=newInputStreamReader(System.in);publicstaticBufferedReaderbr=newBufferedReader(isr);publicStringgetId(){returnid;}publicvoidsetId(Stringid){this.id=id;}publicStringgetName(){returnname;}publicvoidsetName(Stringname){this.name=name;}publicStringgetGrade(){returngrade;}publicvoidsetGrade(Stringgrade){this.grade=grade;}publicStringgetSclass(){returnsclass;}publicvoidsetSclass(Stringsclass){this.sclass=sclass;}publicStringgetQq(){returnqq;}publicvoidsetQq(Stringqq){this.qq=qq;}publicStudent(Stringid,Stringname,Stringgrade,Stringsclass,Stringqq){this.id=id;this.name=name;this.grade=grade;this.sclass=sclass;this.qq=qq;}publicStudent()throwsException{System.out.println(输入学生学号);id=br.readLine();System.out.println(输入学生姓名);name=br.readLine();System.out.println(输入学生年级);grade=br.readLine();System.out.println(输入学生班级);sclass=br.readLine();System.out.println(输入学生qq);qq=br.readLine();}}(4).学生信息管理的接口类publicinterfaceStudentDataBaseInterface{voidaddStudent(Students)throwsException;voidremoveStudent(Stringname);voidupdateStudent(Stringname)throwsException;voidfindStudent(Stringname);voidlistAll();}(5).学生信息管理manage类importjava.io.BufferedReader;importjava.io.InputStreamReader;publicclassManageextendsLinkListimplementsStudentDataBaseInterface{publicstaticInputStreamReaderisr=newInputStreamReader(System.in);publicstaticBufferedReaderbr=newBufferedReader(isr);publicstaticvoidmain(String[]args)throwsException{inti=1;Managem=newManage();System.out.println(欢迎进入学生管理系统);System.out.println(请选择:1.增加学生,2.删除学生,3.修改学生,+4.查找学生,5.打印学生,其他键.退出);i=Integer.parseInt(br.readLine());while(i0&&i6){switch(i){case1:Students=newStudent();m.addStudent(s);break;case2:System.out.println(请输入要删除学生的名字);Stringname;name=br.readLine();m.removeStudent(name);break;case3:System.out.println(请输入要修改学生的名字);Stringname1;name1=br.readLine();m.updateStudent(name1);break;case4:System.out.println(请输入要查找学生的名字);Stringname2;name2=br.readLine();m.findStudent(name2);break;case5:m.listAll();break;}System.out.println(请选择:1.增加学生,2.删除学生,3.修改学生,+4.查找学生,5.打印学生,其他键.退出);i=Integer.parseInt(br.readLine());}m.listAll();}publicManage(){super();}@OverridepublicvoidaddStudent(Students)throwsException{//TODOAuto-generatedmethodstubaddToTail(s);}@OverridepublicvoidremoveStudent(Stringname){//TODOAuto-generatedmethodstubLinkListElementfinger=head;while(finger!=null){Students=(Student)finger.value();if(s.getName().equals(name)){remove(s);System.out.println(成功删除:学号:+s.getId()+姓名:+s.getName()+年级:+s.getGrade()+班别:+s.getSclass()+qq:+s.getQq());break;}else{finger=finger.next();}}}@OverridepublicvoidupdateStudent(Stringname)throwsException{//TODOAuto-generatedmethodstubLinkListElementfinger=head;while(finger!=null){Students=(Student)finger.value();if(s.getName().equals(name)){System.out.println(成功找到:学号:+s.getId()+姓名:+s.getName()+年级:+s.getGrade()+班别:+s.getSclass()+qq:+s.getQq());System.out.println(输入学生新学号);s.setId(br.readLine());System.out.println(输入学生新姓名);s.setName(br.readLine());System.out.println(输入学生新年级);s.setGrade(br.readLine());System.out.println(输入学生新班级);s.setSclass(br.readLine());System.out.println(输入学生新qq);s.setQq(br.readLine());System.out.println(成功修改:学号:+s.getId()+姓名:+s.getName()+年级:+s.getGrade()+班别:+s.getSclass()+qq:+s.getQq());break;}elsefinger=finger.next();}}@OverridepublicvoidfindStudent(Stringname){//TODOAuto-generatedmethodstubLinkListElementfinger=head;while(finger!=null){Students=(Student)finger.value();if(s.getName().equals(name)){System.out.println(成功找到:学号:+s.getId()+姓名:+s.getName()+年级:+s.getGrade()+班别:+s.getSclass()+qq:+s.getQq());break;}elsefinger=finger.next();}}@OverridepublicvoidlistAll(){//TODOAuto-generatedmethodstubLinkListElementf