Java class before the test

Design ideas: first create a package, set up two classes, ScoreInformation ScoreManagement class and class in the package. The definition of seven private variables stunumber, name, mathematicsscore, englishiscore, networkscore, databasescore, softwarescore in ScoreInformation class. And treated with defined GET () (read variable information), and SET () (set the variable information) way to achieve them.

Then ScoreManagement class to define a hh () function, the function is defined in the array, the array is stored in the student's name, student number information. Define a getstudent () function is used to enter the students all subjects. The definition of change () function is used to modify student information. Defined jidian () function is used to score corresponding to the score points. Finally, set the main function, call HH () function, getstudent () function is the main function, Change () function, jidian () function.

 

code:

package duan;

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 ScoreInformation(String stunumber , String name, double mathematicsscore, double englishiscore, double networkscore, double databasescore, double softwarescore) {
// TODO Auto-generated constructor stub
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;
}

}

 

package duan;
import duan.ScoreInformation;
import java.text.DecimalFormat;
import java.util.Scanner;
public class ScoreManagement {
static DecimalFormat df = new DecimalFormat("######0.00");
static boolean z=true;
static ScoreInformation[] a=new ScoreInformation[5];
static void hh(){
a[0]=new ScoreInformation("20183780","段行0",0,0,0,0,0);
a[1]=new ScoreInformation("20183781","段行1",0,0,0,0,0);
a[2]=new ScoreInformation("20183782","段行2",0,0,0,0,0);
a[3]=new ScoreInformation("20183783","段行3",0,0,0,0,0);
a[4]=new ScoreInformation("20183784","段行4",0,0,0,0,0);
}

Scanner Scanner Scan = new new static (System.in);
// student test scores entered
static void getstudent () {

System.out.println ( "******************* **************************************** ");
System.out.println (" Shijiazhuang software Engineering student management system version 2019 Railway University ");
System.out.println (" student test scores entry ");
System.out.println (" ************** ********************************************** ");
System .out.println ( "Please enter the student number: XXXXXXXX");
System.out.println ( "*************************** ********************************* ");
String stunumber1 scan.next = ();
Boolean to false = O;
I int;
for (I = 0; I <. 5; I ++) {
IF (stunumber1.equals (A [I] .getStunumber ())) {
O = to true;
BREAK;
}
}
IF (O) {
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 (" student number "+ a [i] .getStunumber ( ) );
System.out.println ( "student name" + A [i] .getName ());
System.out.println ( "Please enter the higher mathematics achievement:");
A [i] .setMathematicsscore (scan.nextDouble ( ));
System.out.println ( "Please enter university English scores:");
A [i] .setEnglishiscore (scan.nextDouble ());
System.out.println ( "Please enter the university computer network performance:");
A [I] .setNetworkscore (scan.nextDouble ());
the System.out.println ( "Please enter the database performance:");
A [i] .setDatabasescore (scan.nextDouble ());
System.out.println ( "Please enter the Software Engineering results:");
A [i] .setSoftwarescore (scan.nextDouble ());
System.out.println ( "************************************************* *********** ");

System.out.println (" **************************************************************** *********************************************************** ");
System.out.println (" software Engineering, Shijiazhuang Railway Institute student management system Version 2019 ");
System.out.println (" student test scores entry ");
System.out.println (" ************************ ************************************ ");
System.out.println (" student number " A + [I] .getStunumber ());
System.out.println ( "student name" A + [I] .getName ());
System.out.println ( "student number" + a [i] .getMathematicsscore ());
System.out.println ( "Student name "+ a [i] .getEnglishiscore ());
System.out.println ( "student number" + A [I] .getNetworkscore ());
System.out.println ( "student name" A + [I] .getNetworkscore ());
System.out.println ( " student number "+ A [I] .getSoftwarescore ());
System.out.println (" grade has entered the student completed, whether to submit (the Y / N) ");
System.out.println (" **** ************************************************** ****** ");
String = n-scan.next ();
IF (n.equals (" the Y ")) {
System.out.println (" successful entry ");
}
the else {
A [I]. setMathematicsscore (0);
A [I] .setEnglishiscore (0);
A [I] .setNetworkscore (0);
A [I] .setDatabasescore (0);
A [I] .setSoftwarescore (0);
System.out.println ( "entry failed");
}
}
the else {System.out.println ( "Please re-enter input error ");
}

}


static void Change public () {
String stunumber2;
System.out.println ( "********************************* ********************************* ");
System.out.println (" student test scores modification interface ") ;
System.out.println ( "enter the student number");
System.out.println ( "*************************** *************************************** ");
stunumber2 scan.next = ();
for (int = 0 U; U <=. 5; U ++) {
IF (stunumber2.equals (A [U] .getStunumber ())) {
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 ( "student number:" + A [U] .getStunumber ());

System.out.println ( "Student Name:" + A [U] .getName ());

System.out.println ( "higher math" + A [U] .getMathematicsscore ());

System.out.println ( "university English scores." + A [U] .getEnglishiscore ());

System.out.println ( "computer network grades: "A + [U] .getNetworkscore ());

System.out.println (" database performance: "+ a [u] .getDatabasescore ());

System.out.println (" software engineering achievement: "+ a [u ] .getSoftwarescore ());
System.out.println ( "************************************ ******************************** ");

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 (" student number: "+ a [u] .getStunumber ()) ;

System.out.println ( "student name:" + A [U] .getName ());

System.out.println ( "higher math");
A [U] .setMathematicsscore (scan.nextDouble ());
System.out.println ( "College English results:");
A [U] .setEnglishiscore (scan.nextDouble ());
System.out.println ( "computer network performance");
A [U] .setNetworkscore (Scan. nextDouble ());
System.out.println ( "database performance");
A [U] .setDatabasescore (scan.nextDouble ());
System.out.println ( "software Engineering results:");
A [U]. setSoftwarescore (scan.nextDouble ());
System.out.println ( "********************************************************************");
System.out.println ( "");
System.out.println ( "********************************* *********************************** ");
System.out.println (" Shijiazhuang Railway Institute of software Engineering Department of student management system version 2019 ");
System.out.println (" student test scores entry ");
System.out.println (" ******************* ************************************************* " );
System.out.println ( "student number:" + A [U] .getStunumber ());

System.out.println ( "student name:" + A [U] .getName ());

System.out .println ( "higher math" + A [U] .getMathematicsscore ());

System.out.println ( "university English scores" + A [U] .getEnglishiscore ());

System.out.println ( "computer network results: "A + [U] .getNetworkscore ());

System.out.println (" database results: "+ a [u] .getDatabasescore ());

System.out.println ( "Software engineering achievement:" + a [u] .getSoftwarescore ());
System.out.println ( "The student achievement has been the modification is completed, whether or not to submit (the Y-/ N)");
System.out.println ( "******************* ************************************************* " );
String N1;
N1 = scan.next ();
IF (n1.equals ( "the Y")) {
System.out.println ( "the student achievement has been modified successfully");
BREAK;
}
the else {
BREAK;
}
}
{the else
System.out.println ( "student information does not exist");
}
}
}
public static Double jidian (Double A) {
IF (A> = 90) return 4.0;
IF ((A> = 85) && (A < = 89.9)) return 3.7;
IF ((A> = 82) && (A <= 84.9)) return 3.3;
IF ((A> = 78) && (A <= 81.9)) return 3.0;
IF ((A> = 75) && (a <= 77.9))return 2.7;
if((a>=72)&&(a<=74.9))return 2.3;
if((a>68)&&(a<=71.9))return 2.0;
if((a>=66)&&(a<=67.9))return 1.7;
if((a>=64)&&(a<=65.9))return 1.5;
if((a>=60)&&(a<=63.9))return 1.0;
if(a<60)return 0;
return a;

}


static void main public (String [] args) {
Boolean = Hang to true;
HH ();
the while (Hang) Main Menu {//
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 (" *********************************************************** ************************************ ");
System.out.println (" 1, student test scores - recording ");
System.out.println (" 2, student test scores modification ");
System.out.println (" 3, calculate student achievement Grade point ");
System.out.println (" 4, withdraw from school management system ");
System.out.println ("******************************************************************");

scan.nextInt scan_num = int ();
Switch (scan_num) {// Main Menu Select
Case. 1:
getstudent ();
BREAK;
Case 2:
Change ();
BREAK;
Case. 3:
int NUM = 0;
System.out.println ( "*********************************");
System.out.println ( "Shijiazhuang Railway Institute of software Engineering Department of student management system version 2019 ");
System.out.println (" student test scores to calculate grade point interface ");
System.out.println (" **************** ******************************************************** ");
Double B2;
int X3 = 0;
the while (Z) {
System.out.println (" Please enter the student number (number eight Science) : ");
String scan.next B = ();
for (NUM = 0; NUM <. 5; NUM ++)
IF [NUM] (A .getStunumber () the equals (B)) {.
Double C [] = new new Double [ . 5];
C [0] = jidian NUM (A [].getMathematicsscore());
C [. 1] = jidian ([NUM] A .getEnglishiscore ());
C [2] = jidian (A [NUM] .getNetworkscore ());
C [. 3] = jidian ([NUM] A .getDatabasescore ()) ;
C [. 4] = jidian ([NUM] A .getSoftwarescore ());
B2 = (C [0] + C [. 1] + C [2] + C [. 3] + C [. 4]) /. 5;
X3 . 1 =;
System.out.println ( "*********************************");
the System.out. println ( "Shijiazhuang Railway Institute of software Engineering student management system version 2019");
System.out.println ( "\ t student test scores to calculate grade point interface");
System.out.println ( "****** *************************** ");
of System.out.print (" Student ID: ");
System.out.println (A [NUM] .getStunumber ());
of System.out.print ( "name:");
System.out.println [NUM] (A .getName ());
of System.out.print ( ". 1, higher performance in math point: ");
System.out.println (C [0]);
System.out.print ( "2, in Achievement Grade Point Average:");
System.out.println (C [. 1]);
of System.out.print ( ". 3, the computer network GPA results:");
System.out.println (C [2]);
of System.out.print ( ". 4 database performance grade point: ");
System.out.println (c [3]);
System.out.print (" 5, software engineering achievement grade point: ");
System.out.println (c [4]) ;
of System.out.print ( "your GPA is:");
of System.out.print (df.format (B2));
System.out.println ();
IF (B2> = 2) the System.out .println ( "your Grade point has reached the requirements for graduation!");
the else System.out.println ( "your Grade point does not meet the requirements for graduation!");
System.out.println ( "***** **************************** ");
System.out.println (" whether the return to the main screen (Y / N) ");
the while (Z) {
String scan.next A1 = ();
IF (a1.equals ( "the Y")) {
BREAK;}

IF (X3 == 0) {
System.out.println ( "student number into bad!");
BREAK;
}

}

}
BREAK;
}
BREAK;
Case. 4:
System.out.println ( "************************************************************ **************************************************************** ");
System.out.println (" ");
System.out.println (" production : Duan trekking ");
System.out.println (" ");
System.out.println (" ************************************************************ ********************************** ");
Hang = to false;
BREAK;
default:
System.out.println ( "error message, please re-enter");
BREAK;
}

}
}
}

 operation result:

Guess you like

Origin www.cnblogs.com/hang-hang/p/11512799.html