目录1设计目的及内容要求...............................................................................................................12系统总体设计..........................................................................................................................13系统详细设计..........................................................................................................................24运行结果及分析....................................................................................................................17致谢............................................................................................................................................21参考文献....................................................................................................................................22简单学生成绩管理系统的设计与实现1设计目的及内容要求1、设计目的:巩固和加深学生对高级语言程序设计课程的基本知识的理解和掌握,掌握java语言编程和程序调试的基本技能,利用java语言进行基本的软件设计,提高运用java语言解决实际问题的能力。2、内容要求实现学生成绩的管理(增、删、改、查询、持久化、成绩排序、成绩统计等功能),在文件中增加、删除、学生信息,根据学号查询、修改学生信息,统计功能求每个人的总分并按从高到低排序,通过这些操作对文件中的信息保存。2系统总体设计成功登陆系统以后,出现成绩管理界面,系统初始化,可对学生成绩进行增加、删除、查询、修改、统计,进入相应界面进行成绩管理,退出系统自动保存本次操作内容,保存信息。简易流程图:登陆成绩管理界面增加删除查询修改统计退出3系统详细设计①创建Student类,设置变量及对应方法Student.java代码:packagekeshe;importjava.io.Serializable;publicclassStudentimplementsSerializable{privateStringname;privateintnum;privateintyuwen;privateintshuxue;privateintjava;privateintsum=0;publicStudent(){}publicStudent(Stringname,intnum,intyuwen,intshuxue,intjava){super();this.name=name;this.num=num;this.yuwen=yuwen;this.shuxue=shuxue;this.java=java;}publicStringgetName(){returnname;}publicvoidsetName(Stringname){this.name=name;}publicintgetNum(){returnnum;}publicvoidsetNum(intnum){this.num=num;}publicintgetYuwen(){returnyuwen;}publicvoidsetYuwen(intyuwen){this.yuwen=yuwen;}publicintgetShuxue(){returnshuxue;}publicvoidsetShuxue(intshuxue){this.shuxue=shuxue;}publicintgetJava(){returnjava;}publicvoidsetJava(intjava){this.java=java;}publicintgetSum(){returnsum;}publicvoidsetSum(intsum){this.sum=sum;}publicStringtoString(){returnStudent[name=+name+,num=+num+,yuwen=+yuwen+,shuxue=+shuxue+,java=+java+,sum=+sum+];}}②Student管理类StuC,创建对应方法,实现对Student对象的操作(增、删、改、查询、持久化、成绩排序、成绩统计等功能)供其对象调用。StuC.java代码packagekeshe;importjava.io.BufferedReader;importjava.io.File;importjava.io.FileInputStream;importjava.io.FileNotFoundException;importjava.io.FileOutputStream;importjava.io.FileReader;importjava.io.IOException;importjava.io.ObjectInputStream;importjava.io.ObjectOutputStream;importjava.util.ArrayList;publicclassStuC{ArrayListStudental=newArrayListStudent();Filefile=newFile(e:/mydata.dat);//添加publicvoidadds(Students){al.add(s);}//删除publicvoiddel(intn){for(inti=0;ial.size();i++){if(al.get(i).getNum()==n)al.remove(i);}}//求总分publicvoidsum(){for(inti=0;ial.size();i++){al.get(i).setSum(al.get(i).getJava()+al.get(i).getShuxue()+al.get(i).getYuwen());}}//排序publicvoidsort(){for(inti=0;ial.size();i++){for(intj=0;jal.size()-1-i;j++){if(al.get(j).getSum()al.get(j+1).getSum()){Objecto=al.get(j);al.set(j,al.get(j+1));al.set(j+1,(Student)o);}}}}publicvoidpaint(){for(inti=0;ial.size();i++){System.out.println(al.get(i));}}publicStringtoString(){returnStuC[al=+al+];}//输出流publicvoidstor(){ObjectOutputStreamout=null;try{out=newObjectOutputStream(newFileOutputStream(file));out.writeObject(al);out.close();}catch(FileNotFoundExceptione){e.printStackTrace();}catch(IOExceptione){e.printStackTrace();}}//输入流publicvoidread(){ObjectInputStreamin=null;try{in=newObjectInputStream(newFileInputStream(file));try{al=(ArrayListStudent)in.readObject();}catch(ClassNotFoundExceptione){al=null;}in.close();}catch(FileNotFoundExceptione){Filefile=newFile(e:/mydata.dat);}catch(IOExceptione){e.printStackTrace();}}//查找publicStudentfind(intn){for(inti=0;ial.size();i++){if(al.get(i).getNum()==n){returnal.get(i);}}returnnull;}}③登陆界面及成绩管理的所有界面,同过创建StuC的对象,调用其方法实现成绩管理代码:packagekeshe;importjava.awt.*;importjava.awt.event.*;importjava.io.FileNotFoundException;importjava.io.IOException;importjavax.swing.*;publicclassLoginextendsJFrame{privateTextFieldf1;privateTextFieldf2;privateJButtonb1;privateJButtonb2;privateJButtonb3;StuCscs=newStuC();//登陆界面publicLogin(){Containercp=getContentPane();//容器cp.setLayout(newGridLayout(3,1));//三行一列布局Labell1=newLabel(用户名);Labell2=newLabel(密码);Panelp1=newPanel();Panelp2=newPanel();Panelp3=newPanel();f1=newTextField(10);f2=newTextField(10);f2.setEchoChar('*');//回显字符为*b1=newJButton(登录);b2=newJButton(重置);b3=newJButton(退出);p1.add(l1);//第一行添加label1p1.add(f1);p2.add(l2);p2.add(f2);p3.add(b1);p3.add(b2);p3.add(b3);cp.add(p1);cp.add(p2);cp.add(p3);b1.addActionListener(newEnter());b2.addActionListener(newReWrite());b3.addActionListener(newClose());}classEnterimplementsActionListener{publicvoidactionPerformed(ActionEvente){if((f1.getText()).equals(yazhou)&&(f2.getText()).equals(123456)){scs.read();//初始化,从文件读入信息XueShengframe1=newXueSheng();frame1.setBounds(200,200,300,300);frame1.setVisible(true);}elseJOptionPane.showMessageDialog(null,用户名或密码错误,请重新登录!);}}classReWriteimplementsActionListener{publicv