java学生成绩管理系统.docx
- 文档编号:26331551
- 上传时间:2023-06-17
- 格式:DOCX
- 页数:16
- 大小:40.24KB
java学生成绩管理系统.docx
《java学生成绩管理系统.docx》由会员分享,可在线阅读,更多相关《java学生成绩管理系统.docx(16页珍藏版)》请在冰豆网上搜索。
java学生成绩管理系统
importjava.util.Arrays;
importjava.io.*;
importjava.util.Scanner;
publicclassOrder
{Stringm[]=newString[5];Stringe[]=newString[5];
Stringname[]=newString[5];Stringnum[]=newString[5];
publicOrder(Stringm0,Stringm1,Stringm2,Stringm3,Stringm4,Stringe0,Stringe1,Stringe2,Stringe3,
Stringe4,Stringname0,Stringname1,Stringname2,Stringname3,Stringname4,
Stringnum0,Stringnum1,
Stringnum2,Stringnum3,Stringnum4){
this.m[0]=m0;
this.m[1]=m1;
this.m[2]=m2;
this.m[3]=m3;
this.m[4]=m4;
this.e[0]=e0;
this.e[1]=e1;
this.e[2]=e2;
this.e[3]=e3;
this.e[4]=e4;
this.name[0]=name0;
this.name[1]=name1;
this.name[2]=name2;
this.name[3]=name3;
this.name[4]=name4;
this.num[0]=num0;
this.num[1]=num1;
this.num[2]=num2;
this.num[3]=num3;
this.num[4]=num4;
}
publicvoidFuc(){
intm1=Integer.parseInt(m[0]);//将String类型强制转换为int,类型,否则readline不能读取int类型
intm2=Integer.parseInt(m[1]);
intm3=Integer.parseInt(m[2]);
intm4=Integer.parseInt(m[3]);
intm5=Integer.parseInt(m[4]);
inte1=Integer.parseInt(e[0]);
inte2=Integer.parseInt(e[1]);
inte3=Integer.parseInt(e[2]);
infe4"nCDger.parse-nf(e-3一)八
infe5"nCDger.parse-nf(e-4一)八
scdenssfHnewsEdenw
sfolHnewSfudenf
(nameoLnumoLe严ml)八
sf三HnewSfudenf
(name-匸num-二ezm2)八
sf-21HnewSfudenf
(name-2Lnum-2Le3m3)八
sf-31HnewSfudenf
(nameooLnum-3Le4ym4)八
sfsHnewSfudenf
(name_4Lnum_4Leam5)八
Alrays.sort(sf)八
、*for(infiH0二八sf.-engfh二++)
宀
sysCDm•ouf.prinf-n(sf三)八
Y_
ShingWSH-辱■■_+nameo+=<42+numo+=M函■■_+e」+=蒲<■■_+m」+=、辱注
^=+(el+mu
Siring
>■■_-+(e2+m2=
Siring
>■■_-+(e3+m3=
Siring
>■■_-+(e4+m4=
Siring
>■■_-+(e5+m5=
sinkSOUHUnewsink(=d±scdenfgrade一一sort.txv)八
s=r2u=辱■■_+name三+=<
s=r3u=辱■■_+name_2+=<
s=r4H=辱■■_-+name_3+=<
s=r5u=^'=+=3竺4+=<
souM.wriCD-ine(s=rl)souMwriCD=ne(s=r2)souHwriCD=ne(s=r3)souM.wriCD=ne(s=r4)souM.wriCD=ne(s=r5)
souM.coseo-
5'二
for(li'0x5T+)
sysCDmouf.prinf-n(sf三)-
■LFnum三+
■■_=num-2+
■■_=num-3+
■=+num5+
M函■■_+e2+=勞<■'_+m2+=、辱注
M函■■_-+e3+=蒲<■-_-+m3+=、辱注
M函■■_+e4+=選<■'_+m4+=、辱注
M函■■_-+e5+=蒲<■'--+35+=、辱注
publicclassResult{
Stringy[]=newString[5];Stringm[]=newString[5];Result(Stringy1,Stringy2,Stringy3,Stringy4,Stringy5,
Stringm1,Stringm2,Stringm3,Stringm4,Stringm5){
this.y[0]=y1;
this.y[1]=y2;
this.y[2]=y3;
this.y[3]=y4;
this.y[4]=y5;this.m[0]=m1;this.m[1]=m2;this.m[2]=m3;this.m[3]=m4;this.m[4]=m5;
}
publicvoidAverage(){
doubleaveEng;doubleaveMath;
doublei1=Double.parseDouble(y[0]);//将String类型强制转换为int,类型,否则readline不能读取int类型
doublei2=Double.parseDouble(y[1]);
doublei3=Double.parseDouble(y[2]);
doublei4=Double.parseDouble(y[3]);
doublei5=Double.parseDouble(y[4]);
doublej1=Double.parseDouble(m[0]);
doublej2=Double.parseDouble(m[1]);
doublej3=Double.parseDouble(m[2]);
doublej4=Double.parseDouble(m[3]);
doublej5=Double.parseDouble(m[4]);
aveEng=(i1+i2+i3+i4+i5)/5;aveMath=(j1+j2+j3+j4+j5)/5;
System.out.println("五名同学英语平均值为"+aveEng);
System.out.println("五名同学数学平均值为"+aveMath);
}
publicvoidRate(){
intk;doublesum1=0,sum2=0,sum3=0,sum4=0;doubleEngfail,Mathfail,Engpass,Mathpass;
inti1=Integer.parseInt(y[0]);//将String类型强制转换为int,类型,否则readline不能读取int类型
inti2=Integer.parseInt(y[1]);
inti3=Integer.parseInt(y[2]);
inti4=Integer.parseInt(y[3]);
inti5=Integer.parseInt(y[4]);
intj1=Integer.parseInt(m[0]);
intj2=Integer.parseInt(m[1]);
intj3=Integer.parseInt(m[2]);
intj4=Integer.parseInt(m[3]);
intj5=Integer.parseInt(m[4]);
double[]t={i1,i2,i3,i4,i5,j1,j2,j3,j4,j5};
for(k=0;k<5;k++){if(t[k]<60)sum1=sum1+1;
elsesum3=sum3+1;
}
for(k=5;k<10;k++)
{if(t[k]<60)sum2=sum2+1;
elsesum4=sum4+1;
}
Engfail=sum1/5;
Mathfail=sum2/5;
Engpass=sum3/5;
Mathpass=sum4/5;
System.out.println("英语及格率为:
"+Engpass);
System.out.println("数学及格率为:
"+Mathpass);
System.out.println("英语不及格率为:
"+Engfail);
System.out.println("数学不及格率为:
"+Mathfail);
}
publicvoidRank(){
intk;doublesum1=0,sum2=0,sum3=0,sum4=0,sum5=0,sum6=0;doubleEngbest,Engbetter,Enggood;
doubleMathbest,Mathbetter,Mathgood;
inti1=Integer.parseInt(y[0]);//将String类型强制转换为int,类型,否则readline不能读取int类型
inti2=Integer.parseInt(y[1]);
inti3=Integer.parseInt(y[2]);
inti4=Integer.parseInt(y[3]);
inti5=Integer.parseInt(y[4]);
intj1=Integer.parseInt(m[0]);
intj2=Integer.parseInt(m[1]);
intj3=Integer.parseInt(m[2]);
intj4=Integer.parseInt(m[3]);
intj5=Integer.parseInt(m[4]);
double[]t={i1,i2,i3,i4,i5,j1,j2,j3,j4,j5};
for(k=0;k<5;k++){if(t[k]>=90)
sum1=sum1+1;
elseif(t[k]>=80&&t[k]<90)sum2=sum2+1;
elseif(t[k]>=70&&t[k]<80)sum3=sum3+1;
}for(k=5;k<10;k++){if(t[k]>=90)sum4=sum4+1;
elseif(t[k]>=80&&t[k]<90)sum5=sum5+1;
elseif(t[k]>=70&&t[k]<80)sum6=sum6+1;
}
Engbest=sum1/5;
Engbetter=sum2/5;
Enggood=sum3/5;
Mathbest=sum4/5;
Mathbetter=sum5/5;
Mathgood=sum6/5;
System.out.println(”英语***优:
"+Engbest+"良:
"+Engbetter+"中:
"+Enggood);
System.out.println(”数学***优:
"+Mathbest+"良:
"+Mathbetter+"中:
"+Mathgood);
publicclasssink{
privateBufferedWriterbw;
publicsink(Stringfilename){if(filename.toLowerCase().compareTo("stdout")==0)
bw=newBufferedWriter(newOutputStreamWriter(System.out));else{
try{
bw=newBufferedWriter(newFileWriter(filename));
}catch(IOExceptione){
System.out.println(e.getMessage());
System.exit(0);
}
}
}
publicvoidwriteline(Strings){
try{
bw.write(s,0,s.length());
bw.newLine();
}
catch(IOExceptione){
System.out.println(e.getMessage());
System.exit(0);
}
}
publicvoidclose(){
try{
bw.flush();
bw.close();
}
catch(IOExceptione){
System.out.println(e.getMessage());
System.exit(0);
}
}
}
publicclasssource{
privateBufferedReaderbr;
publicsource(Stringfilename){
if(filename.toLowerCase().compareTo("stdin")==0)//判断是否是从键盘输入的
br=newBufferedReader(newInputStreamReader(System.in));//建立缓冲区键盘输入流
else{
try{
br=newBufferedReader(newFileReader(filename));
}
catch(FileNotFoundExceptione){
System.out.println("file'"+filename+"'isnotexisting.");
System.exit(0);
}
}
}
publicStringreadline(){
Strings=newString();
try{
s=br.readLine();
}
catch(IOExceptione){
System.out.println(e.getMessage());
System.exit(0);
}
return(s);
}
publicvoidclose(){
try{
br.close();
}
catch(IOExceptione){
System.out.println(e.getMessage());
System.exit(0);
}
}
}
classStudentimplementsComparable
{
Stringname;
Stringnum;
intEng;
intMaths;
Student(Stringname,Stringnum,intEng,intMaths){
this.name=name;this.num=num;
this.Eng=Eng;this.Maths=Maths;
}
publicintgetTotalScore()
{
returnEng+Maths;
}
publicintcompareTo(Objecto)
{
Students=(Student)o;
returngetTotalScore() 1: (getTotalScore()==s.getTotalScore()0: -1);//这里是重点,实现排序 } publicStringtoString() { return"姓名: "+this.name+"学号: "+this.num+"\n"+"英语: " +this.Eng+"数学: "+this.Maths+"\n"+"总成绩: "+this.getTotalScore(); } } publicclassStudentGrade{ publicstaticvoidmain(String[]args)throwsIOException{ String[][]linein=newString[5][4];String[][]lineout=newString[5][4];sinksout=newsink("d: \\Studentgrade\\BasicInformation.txt");System.out.print("请输入第一个姓名: "); sourcesin1=newsource("stdin"); linein[0][0]=sin1.readline(); lineout[0][0]=linein[0][0];sout.writeline(lineout[0][0]); System.out.print("请输入该学生的学号: "); sourcesin2=newsource("stdin");linein[0][1]=sin2.readline(); lineout[0][1]=linein[0][1]; sout.writeline(lineout[0][1]); System.out.print("请输入该学生的英语成绩: ");sourcesin3=newsource("stdin"); linein[0][2]=sin3.readline();lineout[0][2]=linein[0][2]; sout.writeline(lineout[0][2]); System.out.print("请输入该学生的数学成绩: ");sourcesin4=newsource("stdin"); linein[0][3]=sin4.readline();lineout[0][3]=linein[0][3]; sout.writeline(lineout[0][3]); System.out.print("请输入第二个姓名: ");sourcesin5=newsource("stdin");linein[1][0]=sin5.readline();lineout[1][0]=linein[1][0]; sout.writeline(lineout[1][0]); System.out.print("请输入该学生的学号: ");sourcesin6=newsource("stdin");linein[1][1]=sin6.readline(); lineout[1][1]=linein[1][1]; sout.writeline(lineout[1][1]); System.out.print("请输入该学生的英语成绩: ");sourcesin7=newsource("stdin"); linein[1][2]=sin7.readline();lineout[1][2]=linein[1][2]; sout.writeline(lineout[1][2]); System.out.print("请输入该学生的数学成绩: ");sourcesin8=newsource("stdin");linein[1][3]=sin8.readline(); lineout[1][3]=linein[1][3]; sout.writeline(lineout[1][3]); System.out.print("请输入第三个姓名: ");sourcesin9=newsource("stdin");linein[2][0]=sin9.readline();lineout[2][0]=linein[2][0]; sout.writeline(lineout[2][0]); System.out.print("请输入该学生的学号: ");sourcesin10=newsource("stdin"); linein[2][1]=sin10.readline();lineout[2][1]=linein[2][1]; sout.writeline(lineout[2][1]); System.out.print("请输入该学生的英语成绩: ");sourcesin11=newsource("stdin"); linein[2][2]=sin11.readline();lineout[2][2]=linein[2][2];sout.writeline(lineout[2][2]); System.out.print("请输入该学生的数学成绩: ");sourcesin12=newsource("stdin"); linein[2][3]=sin12.readline();lineout[2][3]=linein[2][3]; sout.writeline(lineout[2][3]); System.out.print("请输入第四个姓名: ");sourcesin13=newsource("stdin");linein[3][0]=sin13.readline(); lineout[3][0]=linein[3][0]; sout.writeline(lineout[3][0]); System.out.print("请输入该学生的学号: ");sourcesin14=newsource("stdin");linein[3][1]=sin14.readline(); lineout[3][1]=linein[3][1]; sout.writeline(lineout[3][1]); System.out.print("请输入该学生的英语成绩: ");sourcesin15=newsource("stdin"); linein[3][2]=sin15.readline();lineout[3][2]=linein[3][2];sout.writeline(lineout[3][2]); System.out.print("请输入该学生的数学成绩: ");sourcesin16=newsource("stdin");linein[3][3]=sin16.readline(); lineout[3][3]=linein[3][3]; sout.writeline(lineout[3][3]); System.out.print("请输入第五个姓名: ");sourcesin17=newsource("stdin"); linein[4][0]=sin17.readline(); lineout[4][0]=lin
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- java 学生 成绩管理系统
![提示](https://static.bdocx.com/images/bang_tan.gif)