欢迎来到天天文库
浏览记录
ID:51869304
大小:37.00 KB
页数:3页
时间:2020-03-17
《学生成绩管理系统(java语言).doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、学生成绩管理系统importjava.util.*;importjava.io.*;classStudentimplementsSerializable{Stringname;longno;privateString[]course={"os","java","math"};double[]cscore={0,0,0};publicStudent(Stringname,longno,doublea,doubleb,doublec){this.name=name;this.no=no;this.cscore[0]=a;this.cscore[
2、1]=b;this.cscore[2]=c;}@OverridepublicStringtoString(){returnthis.name+""+this.no+""+this.course[0]+":"+this.cscore[0]+""+this.course[1]+":"+this.cscore[1]+""+this.course[2]+":"+this.cscore[2];}}publicclassObject{privatestaticScannerscanner=newScanner(System.in);publicStud
3、ent[]read()throwsException{ObjectInputStreamobjIn=newObjectInputStream(newFileInputStream("stus.data"));intnum=objIn.readInt();Student[]stus=newStudent[num];for(inti=0;i4、owsException{Student[]s=newStudent[stus.length+1];for(inti=0;i5、tem.out.print("java成绩:");doublecscore1=scanner.nextDouble();System.out.print("math成绩:");doublecscore2=scanner.nextDouble();s[s.length-1]=newStudent(name,no,cscore0,cscore1,cscore2);save(s);System.out.println("添加成功!");}3publicvoiddispAll(Student[]stus){System.out.println("现6、有Student信息为:");for(Studentstu:stus){System.out.println(stu);}}publicvoidsave(Student[]stus)throwsException{ObjectOutputStreamobjOut=newObjectOutputStream(newFileOutputStream("stus.data"));objOut.writeInt(stus.length);for(Studentstu:stus){objOut.writeObject(stu);}objOut.clo7、se();}publicvoidfindById(Student[]stus){intno=0,i=0;System.out.print("请输入学号:");no=scanner.nextInt();for(i=0;i8、udent[]stus){Stringname="";System.out.print("请输入姓名:");name=scanner.next();for(inti=0;i
4、owsException{Student[]s=newStudent[stus.length+1];for(inti=0;i5、tem.out.print("java成绩:");doublecscore1=scanner.nextDouble();System.out.print("math成绩:");doublecscore2=scanner.nextDouble();s[s.length-1]=newStudent(name,no,cscore0,cscore1,cscore2);save(s);System.out.println("添加成功!");}3publicvoiddispAll(Student[]stus){System.out.println("现6、有Student信息为:");for(Studentstu:stus){System.out.println(stu);}}publicvoidsave(Student[]stus)throwsException{ObjectOutputStreamobjOut=newObjectOutputStream(newFileOutputStream("stus.data"));objOut.writeInt(stus.length);for(Studentstu:stus){objOut.writeObject(stu);}objOut.clo7、se();}publicvoidfindById(Student[]stus){intno=0,i=0;System.out.print("请输入学号:");no=scanner.nextInt();for(i=0;i8、udent[]stus){Stringname="";System.out.print("请输入姓名:");name=scanner.next();for(inti=0;i
5、tem.out.print("java成绩:");doublecscore1=scanner.nextDouble();System.out.print("math成绩:");doublecscore2=scanner.nextDouble();s[s.length-1]=newStudent(name,no,cscore0,cscore1,cscore2);save(s);System.out.println("添加成功!");}3publicvoiddispAll(Student[]stus){System.out.println("现
6、有Student信息为:");for(Studentstu:stus){System.out.println(stu);}}publicvoidsave(Student[]stus)throwsException{ObjectOutputStreamobjOut=newObjectOutputStream(newFileOutputStream("stus.data"));objOut.writeInt(stus.length);for(Studentstu:stus){objOut.writeObject(stu);}objOut.clo
7、se();}publicvoidfindById(Student[]stus){intno=0,i=0;System.out.print("请输入学号:");no=scanner.nextInt();for(i=0;i8、udent[]stus){Stringname="";System.out.print("请输入姓名:");name=scanner.next();for(inti=0;i
8、udent[]stus){Stringname="";System.out.print("请输入姓名:");name=scanner.next();for(inti=0;i
此文档下载收益归作者所有