ScoreInformation类:
package ceshi; class ScoreInformation { private String stunumber; private String name; private double mathematicsscore; private double englishiscore; private double networkscore; private double databasescore; private double softwarescore; public ScoreInformation(){ } public ScoreInformation(String stunumber, String name, double mathematicsscore, double englishiscore, double networkscore, double databasescore, double softwarescore) { this.stunumber = stunumber; this.name = name; this.mathematicsscore = mathematicsscore; this.englishiscore = englishiscore; this.networkscore = networkscore; this.databasescore = databasescore; this.softwarescore = 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; } }Main类:
package ceshi; import java.util.*; public class Main { static ScoreInformation[] scoreInformations=new ScoreInformation[5]; static int n=0; public static void main(String args[]){while (true) { Scanner scanner = new Scanner(System.in); caidan1(); int select = 0; select = scanner.nextInt(); switch (select) { case 1: caidan2(); add(); break; case 2: caidan3(); updata(); break; case 4: quite(); default: System.exit(0); break; }} } static void caidan1(){ 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 public void caidan2(){ System.out.println("***********************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 "); System.out.println(" 学生考试成绩录入 "); System.out.println("***********************************************************"); System.out.println(" 请输入学生学号: "); } static public void caidan3(){ System.out.println("***********************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 "); System.out.println(" 学生考试成绩修改界面 "); System.out.println("***********************************************************"); System.out.println(" 请输入学生学号: "); System.out.println("********************************************************** "); } static public void caidan4(){ System.out.println("***********************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 "); System.out.println(" 学生考试成绩修改界面 "); System.out.println("*********************************************************** "); System.out.println(" 请输入需要修改科目的序号: "); } static void chushihua(){ scoreInformations[0]=new ScoreInformation(); scoreInformations[0].setName("马川"); String s="20183561"; scoreInformations[0].setStunumber(s); scoreInformations[1]=new ScoreInformation(); scoreInformations[1].setName("张三"); String s1="20180000"; scoreInformations[1].setStunumber(s1); scoreInformations[2]=new ScoreInformation(); scoreInformations[2].setName("李四"); String s2="20180001"; scoreInformations[2].setStunumber(s2); scoreInformations[3]=new ScoreInformation(); scoreInformations[3].setName("harden"); String s3="20180002"; scoreInformations[3].setStunumber(s3); scoreInformations[4]=new ScoreInformation(); scoreInformations[4].setName("james"); String s4="20180004"; scoreInformations[4].setStunumber(s4); } static void add(){ Scanner sc = new Scanner(System.in); String stunumber=sc.nextLine(); for(int i=0;i<5;i++){ scoreInformations [i]= new ScoreInformation(); chushihua(); if(scoreInformations[i].getStunumber().equals(stunumber)){ System.out.println("学生姓名:" +scoreInformations[i].getName()); System.out.println("学生学号:"+scoreInformations[i].getStunumber()); System.out.println("请输入高等数学成绩:"); double mathematicsscore=sc.nextDouble(); System.out.println("请输入英语成绩"); double englishiscore=sc.nextDouble(); System.out.println("请输入计算机网络成绩"); double networkscore=sc.nextDouble(); System.out.println("请输入数据库成绩:"); double databasescore=sc.nextDouble(); System.out.println("请输入软件工程成绩:"); double softwarescore=sc.nextDouble(); System.out.println("该同学成绩已录入是否提交(Y/N)"); Scanner sc1=new Scanner(System.in); String panduan=sc1.nextLine(); String y="Y"; if (panduan.equals(y)){ System.out.println("已成功录入!"); } else{ int i1=0; double d1=i1; scoreInformations[i].setDatabasescore(d1); scoreInformations[i].setEnglishiscore(d1); scoreInformations[i].setMathematicsscore(d1); scoreInformations[i].setNetworkscore(d1); scoreInformations[i].setSoftwarescore(d1); caidan2(); } } else{ System.out.println("查无此人"); } break; } } static void updata(){ Scanner sc2=new Scanner(System.in); String stunumber2=sc2.nextLine(); for (int i=0;i<5;i++){ scoreInformations[i]=new ScoreInformation(); chushihua(); if (scoreInformations[i].getStunumber().equals(stunumber2)){ System.out.println("***********************************************************"); System.out.println(" 石家庄铁道大学软件工程系学生学籍管理系统 2019 版 "); System.out.println(" 学生考试成绩修改界面 "); System.out.println("*********************************************************** "); System.out.println("学生学号:"+scoreInformations[i].getStunumber()); System.out.println("学生姓名:"+scoreInformations[i].getName()); System.out.println("1、高等数学成绩:"+scoreInformations[i].getMathematicsscore()); System.out.println("2、英语成绩:"+scoreInformations[i].getEnglishiscore()); System.out.println("3、数据库成绩:"+scoreInformations[i].getDatabasescore()); System.out.println("4、软件工程成绩:"+scoreInformations[i].getSoftwarescore()); System.out.println("5、网络成绩:"+scoreInformations[i].getNetworkscore()); } else { System.out.println("查无此人!"); } } caidan4(); Integer xuanze=sc2.nextInt(); switch (xuanze){ case 1: } } static void quite(){ System.out.println("***********************************************************"); System.out.println(" 谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版 "); System.out.println(" 制作人:马川 "); System.out.println(" ***********************************************************"); } }
原文地址:https://www.cnblogs.com/mac-13/p/11516703.html
时间: 2024-10-07 05:06:08