資源描述:
《學(xué)生成績管理系統(tǒng)(java語言).doc》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、學(xué)生成績管理系統(tǒng)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("現(xiàn)
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("請輸入學(xué)號:");no=scanner.nextInt();for(i=0;i8、udent[]stus){Stringname="";System.out.print("請輸入姓名:");name=scanner.next();for(inti=0;i