java第一次测验
一、 考试 要求: 源代码: //信1805-3班 孙国旭 20183559 ScoreInformation.java package?project; import?java.util.*; public?class?ScoreInformation { ?????private?String stunumber; ?????private?String name; ?????private?double?mathmaticsscore; ?????private?double?englishiscore; ?????private?double?networkscore; ?????private?double?databasescore; ?????private?double?softwarescore; ?????Scanner scan=new?Scanner(System.in); ?????public?void?setstunumber(String stunumber) ?????{ ??????this.stunumber=stunumber; ?????} ?????public?String getstunumber() ?????{ ??????return?stunumber; ?????} ?????public?void?setname(String name) ?????{ ??????this.name=name; ????} ?????public?String getname() ?????{ ??????return?name; ?????} ?????public?void?setmathmaticsscore(double?mathmaticsscore) ?????{ ??????this.mathmaticsscore=mathmaticsscore; ?????} ?????public?double?getmathmaticsscore() ?????{ ??????return?mathmaticsscore; ?????} ?????public?void?setenglishiscore(double?englishiscore) ?????{ ??????this.englishiscore=englishiscore; ?????} ?????public?double?getenglishiscore() ?????{ ??????return?englishiscore; ?????} ?????public?void?setnetworkscore(double?networkscore) ?????{ ??????this.networkscore=networkscore; ?????} ?????public?double?getnetworkscore() ?????{ ??????return?networkscore; ?????} ?????public?void?setdatabasescore(double?databasescore) ?????{ ??????this.databasescore=databasescore; ?????} ?????public?double?getdatabasescore() ?????{ ??????return?databasescore; ?????} ?????public?void?setsoftwarescore(double?softwarescore) ?????{ ??????this.softwarescore=softwarescore; ?????} ?????public?double?getsoftwarescore() ?????{ ??????return?softwarescore; ?????} } ? ? ? ? ? ? ? ? ? ? ? ? ScoreManage.java package?project; import?java.util.*; public?class?ScoreManage { ????static?ScoreInformation s[]=new?ScoreInformation[5]; ????static?int?a; ????static?void?choice() ????{ ??????System.out.println("********************************"); ??????System.out.println(" ????????石家庄铁道大学 "); ??????System.out.println(" ??????学生学籍管理系统2019版"); ??????System.out.println("********************************"); ??????System.out.println(" ????????1、学生考试成绩录入"); ??????System.out.println(" ????????2、学生考试成绩修改"); ??????System.out.println(" ????????3、计算学生成绩绩点"); ??????System.out.println(" ????????4、退出学籍管理系统"); ??????System.out.println("********************************"); ??} ??static?void?function1() ??{ ???System.out.println("***************************************"); ???System.out.println(" ??石家庄铁道大学软件工程系学生学籍管理系统2019版"); ???System.out.println(" ???????????学生考试成绩录入"); ???System.out.println("***************************************"); ??} ??static?void?function2() ??{ ???System.out.println("***************************************"); ???System.out.println(" ??石家庄铁道大学软件工程系学生学籍管理系统2019版"); ???System.out.println(" ???????????学生考试成绩修改界面"); ???System.out.println("***************************************"); ??} ??static?void?function3() ??{ ???System.out.println("***************************************"); ???System.out.println(" ??石家庄铁道大学软件工程系学生学籍管理系统2019版"); ???System.out.println(" ???????????学生考试成绩绩点计算界面"); ???System.out.println("***************************************"); ??} ??static?void?seti() ??{ ???s[0]=new?ScoreInformation(); ???s[0].setstunumber("20183110"); ???s[0].setname("路人甲"); ???s[1]=new?ScoreInformation(); ???s[1].setstunumber("2018111"); ???s[1].setname("路人乙"); ???s[2]=new?ScoreInformation(); ???s[2].setstunumber("2018112"); ???s[2].setname("路人丙"); ???s[3]=new?ScoreInformation(); ???s[3].setstunumber("2018113"); ???s[3].setname("路人丁"); ???s[4]=new?ScoreInformation(); ???s[4].setstunumber("2018114"); ???s[4].setname("路人戊"); ??} ??static?void?input() ??{ ???Scanner scan=new?Scanner(System.in); ???double?mathmaticsscore,englishiscore,networkscore,databasescore,softwarescore; ???function1(); ???System.out.print("请输入八位的学号:"); ???String number; ???number=scan.next(); ???for(int?i=0;i<5;i++) ???{ ????if(number.equals(s[i].getstunumber())) ????{ ?????a=i; ?????break; ????} ????if(i==4) ????{ ?????System.out.println("该学号不存在"); ?????function1(); ????} ???} ???function1(); ???System.out.print("学生学号:"); ???System.out.println(s[a].getstunumber()); ???System.out.print("学生姓名:"); ???System.out.println(s[a].getname()); ???System.out.print("请输入高等数学成绩:"); ???mathmaticsscore=scan.nextDouble(); ???function1(); ???System.out.print("请输入英语成绩:"); ???englishiscore=scan.nextDouble(); ???function1(); ???System.out.print("请输入计算机网络成绩:"); ???networkscore=scan.nextDouble(); ???function1(); ???System.out.print("请输入数据库成绩:"); ???databasescore=scan.nextDouble(); ???function1(); ???System.out.print("请输入软件工程成绩:"); ???softwarescore=scan.nextDouble(); ???function1(); ???System.out.println("学生学号:"+s[a].getstunumber()); ???System.out.println("学生姓名:"+s[a].getname()); ???System.out.println("高等数学成绩:"+mathmaticsscore); ???System.out.println("大学英语成绩:"+englishiscore); ???System.out.println("计算机网络成绩:"+networkscore); ???System.out.println("数据库成绩"+databasescore); ???System.out.println("软件工程成绩:"+softwarescore); ???System.out.println("该学生成绩已录入完毕,是否提交(Y/N)"); ???System.out.println("**************************************"); ???String t; ???t=scan.next(); ???if(t.equals("Y")) ???{ ?????s[a].setmathmaticsscore(mathmaticsscore); ????????s[a].setenglishiscore(englishiscore); ?????s[a].setnetworkscore(networkscore); ?????s[a].setdatabasescore(databasescore); ?????s[a].setsoftwarescore(softwarescore); ???} ???else ???{ ????function1(); ???} ??} ??static?void?change() ??{ ???function2(); ???System.out.print("请输入八位的学号:"); ???Scanner scan=new?Scanner(System.in); ???double?mathmaticsscore?= 0,englishiscore?= 0,networkscore=0,databasescore=0,softwarescore=0; ???String t; ???t=scan.next(); ???function1(); ???System.out.println("学生学号:"+s[a].getstunumber()); ???System.out.println("学生姓名:"+s[a].getname()); ???System.out.println("高等数学成绩:"+s[a].getmathmaticsscore()); ???System.out.println("大学英语成绩:"+s[a].getenglishiscore()); ???System.out.println("计算机网络成绩:"+s[a].getnetworkscore()); ???System.out.println("数据库成绩"+s[a].getdatabasescore()); ???System.out.println("软件工程成绩:"+s[a].getsoftwarescore()); ???int?u; ???u=scan.nextInt(); ???switch(u) ???{ ???case?1: ????function1(); ????System.out.println("学生学号:"+s[a].getstunumber()); ????System.out.println("学生姓名:"+s[a].getname()); ????????????????System.out.print("请输入修改后的高数成绩:"); ?? ????????????????mathmaticsscore=scan.nextDouble(); ????????????????s[a].setmathmaticsscore(mathmaticsscore); ????????????????break; ???case?2: ????function1(); ????System.out.println("学生学号:"+s[a].getstunumber()); ????System.out.println("学生姓名:"+s[a].getname()); ????????????????System.out.print("请输入修改后的英语成绩:"); ?? ????????????????englishiscore=scan.nextDouble(); ????????????????s[a].setenglishiscore(englishiscore); ???????break; ???case?3: ????function1(); ????System.out.println("学生学号:"+s[a].getstunumber()); ????System.out.println("学生姓名:"+s[a].getname()); ????????????????System.out.print("请输入修改后的计算机网络成绩:"); ?? ????????????????networkscore=scan.nextDouble(); ????????????????s[a].setnetworkscore(networkscore); ???????break; ???case?4: ????function1(); ????System.out.println("学生学号:"+s[a].getstunumber()); ????System.out.println("学生姓名:"+s[a].getname()); ????????????????System.out.print("请输入修改后的数据库成绩:"); ?? ????????????????databasescore=scan.nextDouble(); ????????????????s[a].setdatabasescore(databasescore); ???????break; ???case?5: ????function1(); ????System.out.println("学生学号:"+s[a].getstunumber()); ????System.out.println("学生姓名:"+s[a].getname()); ????????????????System.out.print("请输入修改后的软件工程成绩:"); ?? ????????????????softwarescore=scan.nextDouble(); ????????????????s[a].setsoftwarescore(softwarescore); ???????break; ???} ???function1(); ???System.out.println("学生学号:"+s[a].getstunumber()); ???System.out.println("学生姓名:"+s[a].getname()); ???System.out.println("高等数学成绩:"+s[a].getmathmaticsscore()); ???System.out.println("大学英语成绩:"+s[a].getenglishiscore()); ???System.out.println("计算机网络成绩:"+s[a].getnetworkscore()); ???System.out.println("数据库成绩"+s[a].getdatabasescore()); ???System.out.println("软件工程成绩:"+s[a].getsoftwarescore()); ???System.out.println("该学生成绩已录入完毕,是否提交(Y/N)"); ???System.out.println("**************************************"); ???String str; ???str=scan.next(); ???if(str.equals("Y")) ???{ ??????????choice(); ?????????? ???} ???else ???{ ????function2(); ???} ??} ??//实现学分绩点计算功能 ??static?void?calculate() ??{ ?? ???function3(); ???System.out.print("请输入八位的学号:"); ???Scanner scan=new?Scanner(System.in); ???String p; ???p=scan.next(); ???double?m?= 0; ???if(s[a].getmathmaticsscore()<60) ????m=0; ???else?if(s[a].getmathmaticsscore()>=60&&s[a].getmathmaticsscore()<=63.9) ????m=1.0; ???else?if(s[a].getmathmaticsscore()>=64&&s[a].getmathmaticsscore()<=65.9) ????m=1.5; ???else?if(s[a].getmathmaticsscore()>=66&&s[a].getmathmaticsscore()<=67.9) ????m=1.7; ???else?if(s[a].getmathmaticsscore()>=68&&s[a].getmathmaticsscore()<=71.9) ????m=2.0; ???else?if(s[a].getmathmaticsscore()>=72&&s[a].getmathmaticsscore()<=74.9) ????m=2.3; ???else?if(s[a].getmathmaticsscore()>=75&&s[a].getmathmaticsscore()<=77.9) ????m=2.7; ???else?if(s[a].getmathmaticsscore()>=78&&s[a].getmathmaticsscore()<=81.9) ????m=3.0; ???else?if(s[a].getmathmaticsscore()>=82&&s[a].getmathmaticsscore()<=84.9) ????m=3.3; ???else?if(s[a].getmathmaticsscore()>=85&&s[a].getmathmaticsscore()<=89.9) ????m=3.7; ???else?if(s[a].getmathmaticsscore()>=90) ????m=4.0; ???double?e?= 0; ???if(s[a].getenglishiscore()<60) ????e=0; ???else?if(s[a].getenglishiscore()>=60&&s[a].getenglishiscore()<=63.9) ????e=1.0; ???else?if(s[a].getenglishiscore()>=64&&s[a].getenglishiscore()<=65.9) ????e=1.5; ???else?if(s[a].getenglishiscore()>=66&&s[a].getenglishiscore()<=67.9) ????e=1.7; ???else?if(s[a].getenglishiscore()>=68&&s[a].getenglishiscore()<=71.9) ????e=2.0; ???else?if(s[a].getenglishiscore()>=72&&s[a].getenglishiscore()<=74.9) ????e=2.3; ???else?if(s[a].getenglishiscore()>=75&&s[a].getenglishiscore()<=77.9) ????e=2.7; ???else?if(s[a].getenglishiscore()>=78&&s[a].getenglishiscore()<=81.9) ????e=3.0; ???else?if(s[a].getenglishiscore()>=82&&s[a].getenglishiscore()<=84.9) ????e=3.3; ???else?if(s[a].getenglishiscore()>=85&&s[a].getenglishiscore()<=89.9) ????e=3.7; ???else?if(s[a].getenglishiscore()>=90) ????e=4.0; ???double?n?= 0; ???if(s[a].getnetworkscore()<60) ?????n=0; ???else?if(s[a].getnetworkscore()>=60&&s[a].getnetworkscore()<=63.9) ?????n=1.0; ???else?if(s[a].getnetworkscore()>=64&&s[a].getnetworkscore()<=65.9) ?????n=1.5; ???else?if(s[a].getnetworkscore()>=66&&s[a].getnetworkscore()<=67.9) ?????n=1.7; ???else?if(s[a].getnetworkscore()>=68&&s[a].getnetworkscore()<=71.9) ?????n=2.0; ???else?if(s[a].getnetworkscore()>=72&&s[a].getnetworkscore()<=74.9) ?????n=2.3; ???else?if(s[a].getnetworkscore()>=75&&s[a].getnetworkscore()<=77.9) ?????n=2.7; ???else?if(s[a].getnetworkscore()>=78&&s[a].getnetworkscore()<=81.9) ?????n=3.0; ???else?if(s[a].getnetworkscore()>=82&&s[a].getnetworkscore()<=84.9) ?????n=3.3; ???else?if(s[a].getnetworkscore()>=85&&s[a].getnetworkscore()<=89.9) ?????n=3.7; ???else?if(s[a].getnetworkscore()>=90) ?????n=4.0; ???double?d?= 0; ???if(s[a].getdatabasescore()<60) ?????d=0; ???else?if(s[a].getdatabasescore()>=60&&s[a].getdatabasescore()<=63.9) ?????d=1.0; ???else?if(s[a].getdatabasescore()>=64&&s[a].getdatabasescore()<=65.9) ?????d=1.5; ???else?if(s[a].getdatabasescore()>=66&&s[a].getdatabasescore()<=67.9) ?????d=1.7; ???else?if(s[a].getdatabasescore()>=68&&s[a].getdatabasescore()<=71.9) ?????d=2.0; ???else?if(s[a].getdatabasescore()>=72&&s[a].getdatabasescore()<=74.9) ?????d=2.3; ??????else?if(s[a].getdatabasescore()>=75&&s[a].getdatabasescore()<=77.9) ?????d=2.7; ???else?if(s[a].getdatabasescore()>=78&&s[a].getdatabasescore()<=81.9) ?????d=3.0; ???else?if(s[a].getdatabasescore()>=82&&s[a].getdatabasescore()<=84.9) ?????d=3.3; ???else?if(s[a].getdatabasescore()>=85&&s[a].getdatabasescore()<=89.9) ?????d=3.7; ???else?if(s[a].getdatabasescore()>=90) ?????d=4.0; ???double?q?= 0; ???if(s[a].getsoftwarescore()<60) ??????q=0; ???else?if(s[a].getsoftwarescore()>=60&&s[a].getsoftwarescore()<=63.9) ??????q=1.0; ???else?if(s[a].getsoftwarescore()>=64&&s[a].getsoftwarescore()<=65.9) ??????q=1.5; ???else?if(s[a].getsoftwarescore()>=66&&s[a].getsoftwarescore()<=67.9) ??????q=1.7; ???else?if(s[a].getsoftwarescore()>=68&&s[a].getsoftwarescore()<=71.9) ??????q=2.0; ???else?if(s[a].getsoftwarescore()>=72&&s[a].getsoftwarescore()<=74.9) ??????q=2.3; ???else?if(s[a].getsoftwarescore()>=75&&s[a].getsoftwarescore()<=77.9) ??????q=2.7; ???else?if(s[a].getsoftwarescore()>=78&&s[a].getsoftwarescore()<=81.9) ??????q=3.0; ???else?if(s[a].getsoftwarescore()>=82&&s[a].getsoftwarescore()<=84.9) ??????q=3.3; ???else?if(s[a].getsoftwarescore()>=85&&s[a].getsoftwarescore()<=89.9) ??????q=3.7; ???else?if(s[a].getsoftwarescore()>=90) ??????q=4.0; ???double?ave=0; ???ave=(m*4+e*3+n*4+d*3+q*2)/16; ???function3(); ???System.out.println("学生学号:"+s[a].getstunumber()); ???System.out.println("学生姓名:"+s[a].getname()); ???System.out.println("高等数学成绩绩点:"+m); ???System.out.println("大学英语成绩绩点:"+e); ???System.out.println("计算机网络成绩绩点:"+n); ???System.out.println("数据库成绩绩点"+d); ???System.out.println("软件工程成绩绩点:"+q); ???System.out.println("你的平均学分绩点为:"+String.format("%.2f",ave)); ???System.out.print("提示信息:"); ???if(ave>=2) ???{ ????System.out.println("你的学分绩点已达到毕业要求!"); ???} ???else ???{ ????System.out.println("你的学分绩点不满足毕业要求!"); ???} ???System.out.println("是否返回系统主界面:(Y/N)"); ???System.out.println("*****************************"); ???String str; ???str=scan.next(); ???if(str=="Y") ???{ ????choice(); ???} } ??public?static?void?main(String[] args) { ????seti(); ????while(true) ????{ ????????choice(); ????????int?i; ????????Scanner scan=new?Scanner(System.in); ????????i=scan.nextInt(); ????????switch(i) ????????{ ???????????case?1: ???????????input();break; ???????????case?2: ?????????????????change();break; ???????????case?3: ???????????calculate();break; ???????????case?4: ???????????System.out.println("*********************************"); ???????????System.out.println("谢谢使用石家庄铁道大学软件工程系学生学籍管理系统2019版"); ???????????System.out.println(" ????制作人:孙国旭1"); ???????????System.out.println("*********************************"); ???????????break; ????default: ?????System.out.println("该选项不存在"); ????} ????} } } 运行测试结果: ? ? ? ? ? ? ? ? ? ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |