//20183761 司宇明
ScoreInformation.java
import java.lang.Object;
class ScoreInformation {
private String stunumber;
private String name;
private double mathematicsscore;
private double englishscore;
private double networkscore;
private double databasescore;
private double softwarescore;
public ScoreInformation() {
this.stunumber=stunumber;
this.name=name;
this.mathematicsscore=mathematicsscore;
this.englishscore=englishscore;
this.networkscore=networkscore;
this.databasescore=databasescore;
this.softwarescore=softwarescore;
}
//stunumber 的 getter setter
public void setStunumber(String stunumber) {
this.stunumber=stunumber;
}
public String getStunumber() {
return stunumber;
}
//name 的 getter setter
public void setName(String name) {
this.name=name;
}
public String getName() {
return name;
}
//mathematicsscore 的 getter setter
public void setMathematicsscore(double mathematicsscore) {
this.mathematicsscore=mathematicsscore;
}
public double getMathematicsscore() {
return mathematicsscore;
}
//englishscore 的 getter setter
public void setEnglishscore(double englishscore) {
this.englishscore=englishscore;
}
public double getEnglishscore() {
return englishscore;
}
//networkscore 的 getter setter
public void setNetworkscore(double networkscore) {
this.networkscore=networkscore;
}
public double getNetworkscore() {
return networkscore;
}
//databasescore 的 getter setter
public void setDatabasescore(double databasescore) {
this.databasescore=databasescore;
}
public double getDatabasescore() {
return databasescore;
}
//softscore 的 getter setter
public void setSoftwarescore(double softwarescore) {
this.softwarescore=softwarescore;
}
public double getSoftwarescore() {
return softwarescore;
}
}
ScoreManagement.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class ScoreManagement {
ScoreInformation a[]=new ScoreInformation[10];
int sum = 0;
void setManager(int n) throws IOException //输入学生信息
{
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
String str = null;
for(int i=0;i<n;i++)
{
a[i] = new ScoreInformation(); //定义对象,开辟空间
String stunumber=reader.readLine();
a[i].setStunumber(stunumber);
String name=reader.readLine();
a[i].setName(name);
double mathematicsscore = Double.parseDouble(str);
a[i].setMathematicsscore(mathematicsscore);
double englishscore = Double.parseDouble(str);
a[i].setEnglishscore(englishscore);
double networkscore = Double.parseDouble(str);
a[i].setNetworkscore(networkscore);
double databasescore = Double.parseDouble(str);
a[i].setDatabasescore(databasescore);
double softwarescore = Double.parseDouble(str);
a[i].setSoftwarescore(softwarescore);
}
this.sum = n;
}
addStudent void (stunumber String, String name, int Age, Double mathematicsscore, Double englishscore, Double networkscore,
Double databasescore, Double softwarescore) throws IOException
{
System.out.println ( "************* ********************************************** ");
System .out.println ( "Shijiazhuang Railway Institute of software Engineering student management system version 2019");
System.out.println ( "student test scores entry");
System.out.println ( "******** ************************************************** * ");
System.out.println (" enter the student number: ");
// add a new student information
String str = "";
T = 0 int;
for (int I = 0; I <SUM; I ++)
IF (. A [I] .getStunumber () the equals (stunumber))
{
T =. 1;
}
IF (T == 0)
{
A [ SUM] ScoreInformation new new = ();
A [SUM] .setStunumber (stunumber);
A [SUM] .setName (name);
System.out.println ( "student number:" + stunumber);
System.out.println ( "student name:" + name);
System.out.println ( "Please enter the higher mathematics achievement:");
A [SUM] .setMathematicsscore (mathematicsscore);
System.out.println ( "higher mathematics achievement:" + mathematicsscore) ;
System.out.println ( "Please enter university English scores: ");
A [SUM] .setEnglishscore (englishscore);
System.out.println ( "university English scores:" + englishscore);
System.out.println ( "Please enter the computer network performance:");
A [SUM] .setNetworkscore (networkscore );
System.out.println ( "computer network results:" + networkscore);
System.out.println ( "Please enter the database results:");
A [SUM] .setDatabasescore (databasescore);
System.out.println ( " database performance: "+ databasescore);
SUM + = 1;
System.out.println (" Add success ");!
System.out.println (" the completion of student achievement has been entered, whether to submit (the Y-/ N) ");
char CH;
String str1;
Scanner Scanner the In new new = (the System.in);
str1=In.next();
ch=str1.charAt(0);
if(ch=='Y'||ch=='y')
{
this.addStudent(str1, str1, t, softwarescore, softwarescore, softwarescore, softwarescore, softwarescore);
}
if(ch=='N'||ch=='n')
{
this.menu();
}
}
else
System.out.println("学号已存在");
System.out.println("***********************************************************");
}
void updateStudent(String stunumber,String name,int age,double mathematicsscore,double englishscore,double networkscore,
double databasescore,double softwarescore)
{
// modified according to the student number student information
System.out.println ( "********************************** ************************************************************ ");
System.out.println (" Shijiazhuang Railway Institute of software Engineering student management system 2019 Edition ");
System.out.println ( "student test scores modification interface");
System.out.println ( "**************************** ******************************* ");
System.out.println (" enter the student number: ");
0 = I int;
IF (A [I] .getStunumber () the equals (stunumber).)
{
System.out.println ( "student number:");
System.out.println ( "student name:");
the System .out.println ( "1, higher math: "+ a [i] .getMathematicsscore ());
System.out.println ( "2, in Achievement:" + A [I] .getEnglishscore ());
System.out.println ( ". 3, the computer network performance:" + a [i] .getNetworkscore ());
System.out.println ( "4, database performance:" A + [I] .getDatabasescore ());
System.out.println ( ". 5, software Engineering results:" A + [I] .getSoftwarescore ());
}
System.out.println ( "Please enter the modified score");
B = in.nextInt ();
Switch (B)
{
Case. 1: A [I] .setMathematicsscore (mathematicsscore); BREAK;
Case 2: A [I] .setEnglishscore (englishscore); BREAK;
Case. 3: A [I] .setNetworkscore (networkscore); BREAK;
Case. 4: A [I] .setDatabasescore (databasescore);break;
. 5 Case: A [I] .setSoftwarescore (softwarescore); BREAK;
}
System.out.println ( "the student grade has modification, whether to submit (the Y / N)");
char CH2;
String str2;
Scanner new new = the In Scanner (the System.in);
str2 = In.next ();
CH2 = str2.charAt (0);
IF (CH2 == 'the Y' || CH2 == 'Y')
{
this.addStudent ();
}
IF (CH2 == 'N' || CH2 == 'n-')
{
this.menu ();
}
System.out.println ( "******************* **************************************** ");
}
public void menu() {
A int;
Scanner Scanner in = new new (the System.in);
System.out.println ( "**************************************************************** *********************************************************** ");
System.out.println (" software Engineering ") Shijiazhuang Railway Institute;
System .out.println ( "student management system version 2019");
System.out.println ( "**************************** ******************************* ");
System.out.println (" 1, student test scores entry ");
System.out.println ( "2, student test scores modification");
System.out.println ( "3, calculate student achievement Grade Point ");
System.out.println ( "4, quit school management system");
System.out.println ( "*************************** ******************************** ");
System.out.println (" ");
System.out.println ( "Please select (~. 1. 4):");
A = in.nextInt ();
the while (A <A. 1 ||>. 4)
{
of System.out.print ( "out of range input, please re-enter:") ;
A = in.nextInt ();
}
Switch (A)
{
Case. 1: this.addStudent (); BREAK;
Case 2: this.updateStudent (); BREAK;
Case. 3: this.cal (); BREAK;
case 0:System.exit(0);break;
}
}
}
Main.java
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
ScoreInformation stu=new ScoreInformation();
for(int i=0;i<2;i++)
{
a[i]=new ScoreInformation();
}
stu.menu();
}
}