Java编程思路:
先私有定义各个对象 ,然后对每个变量定义 get()(读取变量信息)和 set()(设置变量信息),方便在ScoreManagement 类中调用给对象赋值和读取该对象的值;然后按要求编写主界面函数和退出函数,先简后难;编写主界面是运用switch、case选择;退出函数运用system.exit(-1)强制退出。然后依次编写录入成绩函数、修改成绩函数、和计算绩点的函数,注意题目要求,用for循环找的对应的学号和姓名以及其各科成绩。然后实现Y和N的判断,是Y退出循环,回到主界面,是N回到录入(修改)界面。
package xiaoceshi; public class ScoreInformation { private String stunumber; private String name; private double mathematicsscore; private double englishiscore; private double networkscore; private double databasescore; private double softwarescore; public String getStunumber() { return stunumber; } public void setStunumber(String stunumber) { this.stunumber = stunumber; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getMathematicsscore() { return mathematicsscore; } public void setMathematicsscore(double mathematicsscore) { this.mathematicsscore = mathematicsscore; } public double getEnglishiscore() { return englishiscore; } public void setEnglishiscore(double englishiscore) { this.englishiscore = englishiscore; } public double getNetworkscore() { return networkscore; } public void setNetworkscore(double networkscore) { this.networkscore = networkscore; } public double getDatabasescore() { return databasescore; } public void setDatabasescore(double databasescore) { this.databasescore = databasescore; } public double getSoftwarescore() { return softwarescore; } public void setSoftwarescore(double softwarescore) { this.softwarescore = softwarescore; } public ScoreInformation(String stunumber,String name,double mathematicsscore,double englishiscore,double networkscore,double databasescore,double softwarescore) { } public ScoreInformation() { } }
package xiaoceshi; import java.util.Scanner; public class ScoreManagement { static ScoreInformation s[]=new ScoreInformation[100]; static int N=0; static Scanner scanner=new Scanner(System.in); public static void chushizhi(){ s[0]=new ScoreInformation(); s[0].setStunumber("20183704"); s[0].setName("赵文轩"); s[0].setMathematicsscore(0); s[0].setEnglishiscore(0); s[0].setNetworkscore(0); s[0].setDatabasescore(0); s[0].setSoftwarescore(0); s[1]=new ScoreInformation(); s[1].setStunumber("20183705"); s[1].setName("aaa"); s[1].setMathematicsscore(0); s[1].setEnglishiscore(0); s[1].setNetworkscore(0); s[1].setDatabasescore(0); s[1].setSoftwarescore(0); s[2]=new ScoreInformation(); s[2].setStunumber("20183706"); s[2].setName("bbb"); s[2].setMathematicsscore(0); s[2].setEnglishiscore(0); s[2].setNetworkscore(0); s[2].setDatabasescore(0); s[2].setSoftwarescore(0); s[3]=new ScoreInformation(); s[3].setStunumber("20183707"); s[3].setName("ccc"); s[3].setMathematicsscore(0); s[3].setEnglishiscore(0); s[3].setNetworkscore(0); s[3].setDatabasescore(0); s[3].setSoftwarescore(0); s[4]=new ScoreInformation(); s[4].setStunumber("20183708"); s[4].setName("ddd"); s[4].setMathematicsscore(0); s[4].setEnglishiscore(0); s[4].setNetworkscore(0); s[4].setDatabasescore(0); s[4].setSoftwarescore(0); N=5; } public static void show() { 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("请输入要执行的操作:"); int t=scanner.nextInt(); if(t<1&&t>4)System.out.println("输入的错误信息"); switch(t) { case 1:input();break; case 2:change();break; case 3:jidain();break; case 4:EXIT();break; } } public static void EXIT() { System.out.println("****************************************************"); System.out.println(" 谢谢使用石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 制作人:赵文轩"); System.out.println("****************************************************"); System.exit(-1); } public static void input() { while (true) { int t=0; System.out.println("*****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 请输入学生学号:********"); System.out.println("****************************************************"); System.out.println("请输入八位的学号:"); String a=scanner.next(); for(int i=0;i<N;i++) { if(a.equals(s[i].getStunumber())) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入高等数学成绩:"); System.out.println("****************************************************"); s[i].setMathematicsscore(scanner.nextDouble()); if(s[i].getMathematicsscore()>0&&s[i].getMathematicsscore()<=100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 请输入大学英语成绩:"); System.out.println("****************************************************"); s[i].setEnglishiscore(scanner.nextDouble()); if(s[i].getEnglishiscore()>0&&s[i].getEnglishiscore()<=100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 请输入计算机网络成绩:"); System.out.println("****************************************************"); s[i].setNetworkscore(scanner.nextDouble()); if(s[i].getNetworkscore()>0&&s[i].getNetworkscore()<=100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 请输入数据库成绩:"); System.out.println("****************************************************"); s[i].setDatabasescore(scanner.nextDouble()); if(s[i].getDatabasescore()>0&&s[i].getDatabasescore()<100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 输入数据库成绩:"+s[i].getDatabasescore()); System.out.println(" 请输入软件工程成绩:"); System.out.println("****************************************************"); s[i].setSoftwarescore(scanner.nextDouble()); if(s[i].getSoftwarescore()>0&&s[i].getSoftwarescore()<=100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 数据库成绩:"+s[i].getDatabasescore()); System.out.println(" 软件工程成绩:"+s[i].getSoftwarescore()); System.out.println("****************************************************"); System.out.println(" 该学生成绩已录入完毕,是否提交(Y/N)"); String c=scanner.next(); if(c.equals("Y")) { t=1; break; } else { s[i].setMathematicsscore(0); s[i].setEnglishiscore(0); s[i].setNetworkscore(0); s[i].setDatabasescore(0); s[i].setSoftwarescore(0); break; } } else {t=0;break;} } else {t=0;break;} } else {t=0;break;} } else {t=0;break;} } } else if(i==N-1)System.out.println("该学号不存在"); } if(t==1)break; } } public static void change() { while(true) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 请输入学生学号:********"); System.out.println("****************************************************"); String a=scanner.next(); int i; int m=0; for(i=0;i<N;i++) { if(a.equals(s[i].getStunumber())) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 1.高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 2.大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 3.计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 4.数据库成绩:"+s[i].getDatabasescore()); System.out.println(" 5.软件工程成绩:"+s[i].getSoftwarescore()); System.out.println("****************************************************"); double x1,x2,x3,x4,x5; x1=s[i].getMathematicsscore(); x2=s[i].getEnglishiscore(); x3=s[i].getNetworkscore(); x4=s[i].getDatabasescore(); x5=s[i].getSoftwarescore(); System.out.println("请输入要修改的科目:"); int t; t=scanner.nextInt(); switch(t) { case 1: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后的高等数学成绩:"); s[i].setMathematicsscore(scanner.nextDouble()); break; case 2: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后的大学英语成绩:"); s[i].setEnglishiscore(scanner.nextDouble()); break; case 3: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后的计算机网络成绩:"); s[i].setNetworkscore(scanner.nextDouble()); break; case 4: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后数据库的成绩:"); s[i].setDatabasescore(scanner.nextDouble()); break; case 5: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后软件工程的成绩:"); s[i].setSoftwarescore(scanner.nextDouble()); break; } System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 1.高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 2.大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 3.计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 4.数据库成绩:"+s[i].getDatabasescore()); System.out.println(" 5.软件工程成绩:"+s[i].getSoftwarescore()); System.out.println(" 该同学成绩已经修改完毕,是否提交(Y/N)"); System.out.println("****************************************************"); String n=scanner.next(); if(n.equals("Y")){m=1;break;} else { s[i].setMathematicsscore(x1); s[i].setEnglishiscore(x2); s[i].setNetworkscore(x3); s[i].setDatabasescore(x4); s[i].setSoftwarescore(x5); break; } } else if(i==N-1) { System.out.println("该学号不存在"); } } if(m==1)break; } } public static void jidain() { int t=0; double mathematicsscore=0; double englishiscore=0; double networkscore=0; double databasescore=0; double softwarescore=0; double pingjun=0; System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩绩点计算界面"); System.out.println("****************************************************"); System.out.println(" 请输入学生学号:"); System.out.println("****************************************************"); String a =scanner.next(); for(int i=0;i<N;i++) { if(a.equals(s[i].getStunumber())) { if(s[i].getMathematicsscore()>=90)mathematicsscore=4; else if(s[i].getMathematicsscore()>=85&&s[i].getMathematicsscore()<=89.9)mathematicsscore=3.7; else if(s[i].getMathematicsscore()>=82&&s[i].getMathematicsscore()<=84.9)mathematicsscore=3.3; else if(s[i].getMathematicsscore()>=78&&s[i].getMathematicsscore()<=81.9)mathematicsscore=3.0; else if(s[i].getMathematicsscore()>=75&&s[i].getMathematicsscore()<=77.9)mathematicsscore=2.7; else if(s[i].getMathematicsscore()>=72&&s[i].getMathematicsscore()<=74.9)mathematicsscore=2.3; else if(s[i].getMathematicsscore()>=68&&s[i].getMathematicsscore()<=71.9)mathematicsscore=2.0; else if(s[i].getMathematicsscore()>=66&&s[i].getMathematicsscore()<=67.9)mathematicsscore=1.7; else if(s[i].getMathematicsscore()>=64&&s[i].getMathematicsscore()<=65.9)mathematicsscore=1.5; else if(s[i].getMathematicsscore()>=60&&s[i].getMathematicsscore()<=63.9)mathematicsscore=1.0; else if(s[i].getMathematicsscore()<60)mathematicsscore=0; if(s[i].getEnglishiscore()>=90)mathematicsscore=4; else if(s[i].getEnglishiscore()>=85&&s[i].getEnglishiscore()<=89.9)englishiscore=3.7; else if(s[i].getEnglishiscore()>=82&&s[i].getEnglishiscore()<=84.9)englishiscore=3.3; else if(s[i].getEnglishiscore()>=78&&s[i].getEnglishiscore()<=81.9)englishiscore=3.0; else if(s[i].getEnglishiscore()>=75&&s[i].getEnglishiscore()<=77.9)englishiscore=2.7; else if(s[i].getEnglishiscore()>=72&&s[i].getEnglishiscore()<=74.9)englishiscore=2.3; else if(s[i].getEnglishiscore()>=68&&s[i].getEnglishiscore()<=71.9)englishiscore=2.0; else if(s[i].getEnglishiscore()>=66&&s[i].getEnglishiscore()<=67.9)englishiscore=1.7; else if(s[i].getEnglishiscore()>=64&&s[i].getEnglishiscore()<=65.9)englishiscore=1.5; else if(s[i].getEnglishiscore()>=60&&s[i].getEnglishiscore()<=63.9)englishiscore=1.0; else if(s[i].getEnglishiscore()<60)englishiscore=0; if(s[i].getNetworkscore()>=90)networkscore=4; else if(s[i].getNetworkscore()>=85&&s[i].getNetworkscore()<=89.9)networkscore=3.7; else if(s[i].getNetworkscore()>=82&&s[i].getNetworkscore()<=84.9)networkscore=3.3; else if(s[i].getNetworkscore()>=78&&s[i].getNetworkscore()<=81.9)networkscore=3.0; else if(s[i].getNetworkscore()>=75&&s[i].getNetworkscore()<=77.9)networkscore=2.7; else if(s[i].getNetworkscore()>=72&&s[i].getNetworkscore()<=74.9)networkscore=2.3; else if(s[i].getNetworkscore()>=68&&s[i].getNetworkscore()<=71.9)networkscore=2.0; else if(s[i].getNetworkscore()>=66&&s[i].getNetworkscore()<=67.9)networkscore=1.7; else if(s[i].getNetworkscore()>=64&&s[i].getNetworkscore()<=65.9)networkscore=1.5; else if(s[i].getNetworkscore()>=60&&s[i].getNetworkscore()<=63.9)networkscore=1.0; else if(s[i].getNetworkscore()<60)networkscore=0; if(s[i].getDatabasescore()>=90)databasescore=4; else if(s[i].getDatabasescore()>=85&&s[i].getDatabasescore()<=89.9)databasescore=3.7; else if(s[i].getDatabasescore()>=82&&s[i].getDatabasescore()<=84.9)databasescore=3.3; else if(s[i].getDatabasescore()>=78&&s[i].getDatabasescore()<=81.9)databasescore=3.0; else if(s[i].getDatabasescore()>=75&&s[i].getDatabasescore()<=77.9)databasescore=2.7; else if(s[i].getDatabasescore()>=72&&s[i].getDatabasescore()<=74.9)databasescore=2.3; else if(s[i].getDatabasescore()>=68&&s[i].getDatabasescore()<=71.9)databasescore=2.0; else if(s[i].getDatabasescore()>=66&&s[i].getDatabasescore()<=67.9)databasescore=1.7; else if(s[i].getDatabasescore()>=64&&s[i].getDatabasescore()<=65.9)databasescore=1.5; else if(s[i].getDatabasescore()>=60&&s[i].getDatabasescore()<=63.9)databasescore=1.0; else if(s[i].getDatabasescore()<60)databasescore=0; if(s[i].getSoftwarescore()>=90)softwarescore=4; else if(s[i].getSoftwarescore()>=85&&s[i].getSoftwarescore()<=89.9)softwarescore=3.7; else if(s[i].getSoftwarescore()>=82&&s[i].getSoftwarescore()<=84.9)softwarescore=3.3; else if(s[i].getSoftwarescore()>=78&&s[i].getSoftwarescore()<=81.9)softwarescore=3.0; else if(s[i].getSoftwarescore()>=75&&s[i].getSoftwarescore()<=77.9)softwarescore=2.7; else if(s[i].getSoftwarescore()>=72&&s[i].getSoftwarescore()<=74.9)softwarescore=2.3; else if(s[i].getSoftwarescore()>=68&&s[i].getSoftwarescore()<=71.9)softwarescore=2.0; else if(s[i].getSoftwarescore()>=66&&s[i].getSoftwarescore()<=67.9)softwarescore=1.7; else if(s[i].getSoftwarescore()>=64&&s[i].getSoftwarescore()<=65.9)softwarescore=1.5; else if(s[i].getSoftwarescore()>=60&&s[i].getSoftwarescore()<=63.9)softwarescore=1.0; else if(s[i].getSoftwarescore()<60)softwarescore=0; pingjun=(4*s[i].getMathematicsscore()+3*s[i].getEnglishiscore()+4*s[i].getNetworkscore()+3*s[i].getDatabasescore()+2*s[i].getSoftwarescore())/16; System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩绩点计算界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 1.高等数学绩点:"+mathematicsscore); System.out.println(" 2.大学英语绩点:"+englishiscore); System.out.println(" 3.计算机网络绩点:"+networkscore); System.out.println(" 4.数据库绩点:"+databasescore); System.out.println(" 5.软件工程绩点:"+softwarescore); System.out.println(" 你的平均学分绩点为:"+pingjun); if(pingjun>=2)System.out.println(" 你的学分绩点已达到毕业要求!" ); else System.out.println(" 你的学分绩点不满足毕业要求!" ); System.out.println(" 是否返回系统主界面:(Y/N)"); System.out.println("****************************************************"); String c=scanner.next(); if(c.equals("Y")){t=1;break;} else break; } else if(i==N-1)System.out.println("该学号不存在"); } if(t==1)show(); } public static void main(String agre[]) { chushizhi(); while(true) { show(); } } }
---恢复内容结束---
package xiaoceshi; public class ScoreInformation { private String stunumber; private String name; private double mathematicsscore; private double englishiscore; private double networkscore; private double databasescore; private double softwarescore; public String getStunumber() { return stunumber; } public void setStunumber(String stunumber) { this.stunumber = stunumber; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getMathematicsscore() { return mathematicsscore; } public void setMathematicsscore(double mathematicsscore) { this.mathematicsscore = mathematicsscore; } public double getEnglishiscore() { return englishiscore; } public void setEnglishiscore(double englishiscore) { this.englishiscore = englishiscore; } public double getNetworkscore() { return networkscore; } public void setNetworkscore(double networkscore) { this.networkscore = networkscore; } public double getDatabasescore() { return databasescore; } public void setDatabasescore(double databasescore) { this.databasescore = databasescore; } public double getSoftwarescore() { return softwarescore; } public void setSoftwarescore(double softwarescore) { this.softwarescore = softwarescore; } public ScoreInformation(String stunumber,String name,double mathematicsscore,double englishiscore,double networkscore,double databasescore,double softwarescore) { } public ScoreInformation() { } }
package xiaoceshi; import java.util.Scanner; public class ScoreManagement { static ScoreInformation s[]=new ScoreInformation[100]; static int N=0; static Scanner scanner=new Scanner(System.in); public static void chushizhi(){ s[0]=new ScoreInformation(); s[0].setStunumber("20183704"); s[0].setName("赵文轩"); s[0].setMathematicsscore(0); s[0].setEnglishiscore(0); s[0].setNetworkscore(0); s[0].setDatabasescore(0); s[0].setSoftwarescore(0); s[1]=new ScoreInformation(); s[1].setStunumber("20183705"); s[1].setName("aaa"); s[1].setMathematicsscore(0); s[1].setEnglishiscore(0); s[1].setNetworkscore(0); s[1].setDatabasescore(0); s[1].setSoftwarescore(0); s[2]=new ScoreInformation(); s[2].setStunumber("20183706"); s[2].setName("bbb"); s[2].setMathematicsscore(0); s[2].setEnglishiscore(0); s[2].setNetworkscore(0); s[2].setDatabasescore(0); s[2].setSoftwarescore(0); s[3]=new ScoreInformation(); s[3].setStunumber("20183707"); s[3].setName("ccc"); s[3].setMathematicsscore(0); s[3].setEnglishiscore(0); s[3].setNetworkscore(0); s[3].setDatabasescore(0); s[3].setSoftwarescore(0); s[4]=new ScoreInformation(); s[4].setStunumber("20183708"); s[4].setName("ddd"); s[4].setMathematicsscore(0); s[4].setEnglishiscore(0); s[4].setNetworkscore(0); s[4].setDatabasescore(0); s[4].setSoftwarescore(0); N=5; } public static void show() { 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("请输入要执行的操作:"); int t=scanner.nextInt(); if(t<1&&t>4)System.out.println("输入的错误信息"); switch(t) { case 1:input();break; case 2:change();break; case 3:jidain();break; case 4:EXIT();break; } } public static void EXIT() { System.out.println("****************************************************"); System.out.println(" 谢谢使用石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 制作人:赵文轩"); System.out.println("****************************************************"); System.exit(-1); } public static void input() { while (true) { int t=0; System.out.println("*****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 请输入学生学号:********"); System.out.println("****************************************************"); System.out.println("请输入八位的学号:"); String a=scanner.next(); for(int i=0;i<N;i++) { if(a.equals(s[i].getStunumber())) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入高等数学成绩:"); System.out.println("****************************************************"); s[i].setMathematicsscore(scanner.nextDouble()); if(s[i].getMathematicsscore()>0&&s[i].getMathematicsscore()<=100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 请输入大学英语成绩:"); System.out.println("****************************************************"); s[i].setEnglishiscore(scanner.nextDouble()); if(s[i].getEnglishiscore()>0&&s[i].getEnglishiscore()<=100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 请输入计算机网络成绩:"); System.out.println("****************************************************"); s[i].setNetworkscore(scanner.nextDouble()); if(s[i].getNetworkscore()>0&&s[i].getNetworkscore()<=100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 请输入数据库成绩:"); System.out.println("****************************************************"); s[i].setDatabasescore(scanner.nextDouble()); if(s[i].getDatabasescore()>0&&s[i].getDatabasescore()<100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 输入数据库成绩:"+s[i].getDatabasescore()); System.out.println(" 请输入软件工程成绩:"); System.out.println("****************************************************"); s[i].setSoftwarescore(scanner.nextDouble()); if(s[i].getSoftwarescore()>0&&s[i].getSoftwarescore()<=100) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩录入界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 数据库成绩:"+s[i].getDatabasescore()); System.out.println(" 软件工程成绩:"+s[i].getSoftwarescore()); System.out.println("****************************************************"); System.out.println(" 该学生成绩已录入完毕,是否提交(Y/N)"); String c=scanner.next(); if(c.equals("Y")) { t=1; break; } else { s[i].setMathematicsscore(0); s[i].setEnglishiscore(0); s[i].setNetworkscore(0); s[i].setDatabasescore(0); s[i].setSoftwarescore(0); break; } } else {t=0;break;} } else {t=0;break;} } else {t=0;break;} } else {t=0;break;} } } else if(i==N-1)System.out.println("该学号不存在"); } if(t==1)break; } } public static void change() { while(true) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 请输入学生学号:********"); System.out.println("****************************************************"); String a=scanner.next(); int i; int m=0; for(i=0;i<N;i++) { if(a.equals(s[i].getStunumber())) { System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 1.高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 2.大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 3.计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 4.数据库成绩:"+s[i].getDatabasescore()); System.out.println(" 5.软件工程成绩:"+s[i].getSoftwarescore()); System.out.println("****************************************************"); double x1,x2,x3,x4,x5; x1=s[i].getMathematicsscore(); x2=s[i].getEnglishiscore(); x3=s[i].getNetworkscore(); x4=s[i].getDatabasescore(); x5=s[i].getSoftwarescore(); System.out.println("请输入要修改的科目:"); int t; t=scanner.nextInt(); switch(t) { case 1: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后的高等数学成绩:"); s[i].setMathematicsscore(scanner.nextDouble()); break; case 2: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后的大学英语成绩:"); s[i].setEnglishiscore(scanner.nextDouble()); break; case 3: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后的计算机网络成绩:"); s[i].setNetworkscore(scanner.nextDouble()); break; case 4: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后数据库的成绩:"); s[i].setDatabasescore(scanner.nextDouble()); break; case 5: System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 请输入修改后软件工程的成绩:"); s[i].setSoftwarescore(scanner.nextDouble()); break; } System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩修改界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 1.高等数学成绩:"+s[i].getMathematicsscore()); System.out.println(" 2.大学英语成绩:"+s[i].getEnglishiscore()); System.out.println(" 3.计算机网络成绩:"+s[i].getNetworkscore()); System.out.println(" 4.数据库成绩:"+s[i].getDatabasescore()); System.out.println(" 5.软件工程成绩:"+s[i].getSoftwarescore()); System.out.println(" 该同学成绩已经修改完毕,是否提交(Y/N)"); System.out.println("****************************************************"); String n=scanner.next(); if(n.equals("Y")){m=1;break;} else { s[i].setMathematicsscore(x1); s[i].setEnglishiscore(x2); s[i].setNetworkscore(x3); s[i].setDatabasescore(x4); s[i].setSoftwarescore(x5); break; } } else if(i==N-1) { System.out.println("该学号不存在"); } } if(m==1)break; } } public static void jidain() { int t=0; double mathematicsscore=0; double englishiscore=0; double networkscore=0; double databasescore=0; double softwarescore=0; double pingjun=0; System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩绩点计算界面"); System.out.println("****************************************************"); System.out.println(" 请输入学生学号:"); System.out.println("****************************************************"); String a =scanner.next(); for(int i=0;i<N;i++) { if(a.equals(s[i].getStunumber())) { if(s[i].getMathematicsscore()>=90)mathematicsscore=4; else if(s[i].getMathematicsscore()>=85&&s[i].getMathematicsscore()<=89.9)mathematicsscore=3.7; else if(s[i].getMathematicsscore()>=82&&s[i].getMathematicsscore()<=84.9)mathematicsscore=3.3; else if(s[i].getMathematicsscore()>=78&&s[i].getMathematicsscore()<=81.9)mathematicsscore=3.0; else if(s[i].getMathematicsscore()>=75&&s[i].getMathematicsscore()<=77.9)mathematicsscore=2.7; else if(s[i].getMathematicsscore()>=72&&s[i].getMathematicsscore()<=74.9)mathematicsscore=2.3; else if(s[i].getMathematicsscore()>=68&&s[i].getMathematicsscore()<=71.9)mathematicsscore=2.0; else if(s[i].getMathematicsscore()>=66&&s[i].getMathematicsscore()<=67.9)mathematicsscore=1.7; else if(s[i].getMathematicsscore()>=64&&s[i].getMathematicsscore()<=65.9)mathematicsscore=1.5; else if(s[i].getMathematicsscore()>=60&&s[i].getMathematicsscore()<=63.9)mathematicsscore=1.0; else if(s[i].getMathematicsscore()<60)mathematicsscore=0; if(s[i].getEnglishiscore()>=90)mathematicsscore=4; else if(s[i].getEnglishiscore()>=85&&s[i].getEnglishiscore()<=89.9)englishiscore=3.7; else if(s[i].getEnglishiscore()>=82&&s[i].getEnglishiscore()<=84.9)englishiscore=3.3; else if(s[i].getEnglishiscore()>=78&&s[i].getEnglishiscore()<=81.9)englishiscore=3.0; else if(s[i].getEnglishiscore()>=75&&s[i].getEnglishiscore()<=77.9)englishiscore=2.7; else if(s[i].getEnglishiscore()>=72&&s[i].getEnglishiscore()<=74.9)englishiscore=2.3; else if(s[i].getEnglishiscore()>=68&&s[i].getEnglishiscore()<=71.9)englishiscore=2.0; else if(s[i].getEnglishiscore()>=66&&s[i].getEnglishiscore()<=67.9)englishiscore=1.7; else if(s[i].getEnglishiscore()>=64&&s[i].getEnglishiscore()<=65.9)englishiscore=1.5; else if(s[i].getEnglishiscore()>=60&&s[i].getEnglishiscore()<=63.9)englishiscore=1.0; else if(s[i].getEnglishiscore()<60)englishiscore=0; if(s[i].getNetworkscore()>=90)networkscore=4; else if(s[i].getNetworkscore()>=85&&s[i].getNetworkscore()<=89.9)networkscore=3.7; else if(s[i].getNetworkscore()>=82&&s[i].getNetworkscore()<=84.9)networkscore=3.3; else if(s[i].getNetworkscore()>=78&&s[i].getNetworkscore()<=81.9)networkscore=3.0; else if(s[i].getNetworkscore()>=75&&s[i].getNetworkscore()<=77.9)networkscore=2.7; else if(s[i].getNetworkscore()>=72&&s[i].getNetworkscore()<=74.9)networkscore=2.3; else if(s[i].getNetworkscore()>=68&&s[i].getNetworkscore()<=71.9)networkscore=2.0; else if(s[i].getNetworkscore()>=66&&s[i].getNetworkscore()<=67.9)networkscore=1.7; else if(s[i].getNetworkscore()>=64&&s[i].getNetworkscore()<=65.9)networkscore=1.5; else if(s[i].getNetworkscore()>=60&&s[i].getNetworkscore()<=63.9)networkscore=1.0; else if(s[i].getNetworkscore()<60)networkscore=0; if(s[i].getDatabasescore()>=90)databasescore=4; else if(s[i].getDatabasescore()>=85&&s[i].getDatabasescore()<=89.9)databasescore=3.7; else if(s[i].getDatabasescore()>=82&&s[i].getDatabasescore()<=84.9)databasescore=3.3; else if(s[i].getDatabasescore()>=78&&s[i].getDatabasescore()<=81.9)databasescore=3.0; else if(s[i].getDatabasescore()>=75&&s[i].getDatabasescore()<=77.9)databasescore=2.7; else if(s[i].getDatabasescore()>=72&&s[i].getDatabasescore()<=74.9)databasescore=2.3; else if(s[i].getDatabasescore()>=68&&s[i].getDatabasescore()<=71.9)databasescore=2.0; else if(s[i].getDatabasescore()>=66&&s[i].getDatabasescore()<=67.9)databasescore=1.7; else if(s[i].getDatabasescore()>=64&&s[i].getDatabasescore()<=65.9)databasescore=1.5; else if(s[i].getDatabasescore()>=60&&s[i].getDatabasescore()<=63.9)databasescore=1.0; else if(s[i].getDatabasescore()<60)databasescore=0; if(s[i].getSoftwarescore()>=90)softwarescore=4; else if(s[i].getSoftwarescore()>=85&&s[i].getSoftwarescore()<=89.9)softwarescore=3.7; else if(s[i].getSoftwarescore()>=82&&s[i].getSoftwarescore()<=84.9)softwarescore=3.3; else if(s[i].getSoftwarescore()>=78&&s[i].getSoftwarescore()<=81.9)softwarescore=3.0; else if(s[i].getSoftwarescore()>=75&&s[i].getSoftwarescore()<=77.9)softwarescore=2.7; else if(s[i].getSoftwarescore()>=72&&s[i].getSoftwarescore()<=74.9)softwarescore=2.3; else if(s[i].getSoftwarescore()>=68&&s[i].getSoftwarescore()<=71.9)softwarescore=2.0; else if(s[i].getSoftwarescore()>=66&&s[i].getSoftwarescore()<=67.9)softwarescore=1.7; else if(s[i].getSoftwarescore()>=64&&s[i].getSoftwarescore()<=65.9)softwarescore=1.5; else if(s[i].getSoftwarescore()>=60&&s[i].getSoftwarescore()<=63.9)softwarescore=1.0; else if(s[i].getSoftwarescore()<60)softwarescore=0; pingjun=(4*s[i].getMathematicsscore()+3*s[i].getEnglishiscore()+4*s[i].getNetworkscore()+3*s[i].getDatabasescore()+2*s[i].getSoftwarescore())/16; System.out.println("****************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统2019版"); System.out.println(" 学生考试成绩绩点计算界面"); System.out.println("****************************************************"); System.out.println(" 学生学号:"+s[i].getStunumber()); System.out.println(" 学生姓名:"+s[i].getName()); System.out.println(" 1.高等数学绩点:"+mathematicsscore); System.out.println(" 2.大学英语绩点:"+englishiscore); System.out.println(" 3.计算机网络绩点:"+networkscore); System.out.println(" 4.数据库绩点:"+databasescore); System.out.println(" 5.软件工程绩点:"+softwarescore); System.out.println(" 你的平均学分绩点为:"+pingjun); if(pingjun>=2)System.out.println(" 你的学分绩点已达到毕业要求!" ); else System.out.println(" 你的学分绩点不满足毕业要求!" ); System.out.println(" 是否返回系统主界面:(Y/N)"); System.out.println("****************************************************"); String c=scanner.next(); if(c.equals("Y")){t=1;break;} else break; } else if(i==N-1)System.out.println("该学号不存在"); } if(t==1)show(); } public static void main(String agre[]) { chushizhi(); while(true) { show(); } } }
原文地址:https://www.cnblogs.com/zwx655/p/11505132.html
时间: 2024-10-08 11:39:11