Java quiz code and a screenshot

Source

20183584 //
// Liurui Yang
// channel 1805-3 class
Package scoreinformation;
Import Classes in java.util *;.
Import the java.text.DecimalFormat;
Import java.util.Scanner;
Import scoreinformation.ScoreInformation;
public class ScoreManagement {
static Scanner in = Scanner new new (the System.in);
static void the display () {
System.out.println ( "**************************************************************** *********************************************************** ");
System.out.println (" \ t \ t software Engineering, Shijiazhuang Railway Institute ");
System.out.println (" \ t \ t student management system version 2019 ");
System.out.println (" ******************** *************************************** ");
System.out.println (" \ t \ t1, student test scores entry ");
System.out.println (" \ t \ T2, student test scores modification ");
System.out.println ( "\ t \ t3, calculate student achievement Grade Point");
System.out.println ( "\ t \ T4, quit school management system");
System.out.println ( "**** ************************************************** ***** ");
}
static void displayexit () {
System.out.println (" **************************** ******************************* ");
System.out.println (" \ t \ t Thank use of Shijiazhuang Railway Institute software Engineering student management system version 2019 ");
System.out.println (" \ t \ t producer: Liu Ruiyang ");
System.out.println (" ************* ********************************************** ");
System .exit (0);
}

static void displayscorescan () {
System.out.println ( "************************************************************ **************************************************************** ");
System.out.println ("\ T \ t Shijiazhuang Railway Institute of Software Engineering Student Management System 2019 Edition ");
System.out.println ( "\ t \ t student test scores Entry");
System.out.println ( "************************************************************ ********************************** ");
System.out.println (" \ t \ t enter student number: XXXXXXXX ");
System.out.println (" *********************************** ************************************************************ ");
scorescan ();
}
static void scorescan () {

String = in.next STR ();
int In Flag = 0;
for (int I = 0; I <. 5; I ++) {
IF (str.equals (STU [I] .getstunumber ())) {
System.out.println ( "student information:" + "name:" + stu [i] .getname () + "," + " Student ID:" + STU [I] .getstunumber ());
displayscorescan2 (I);
In Flag =. 1;
}
}
IF (In Flag == 0) {
the System. out.println ( "Without this student!");
displayscorescan();
}
}
void displayscorescan2 static (int A) {
System.out.println ( "*********************************** ************************ ");
System.out.println (" \ t \ t software Engineering, Shijiazhuang Railway Institute student management system version 2019 ");
System.out.println (" \ t \ t student test scores entry ");
System.out.println (" ********************** ************************************* ");
System.out.println (" \ t \ t student number: "+ STU [A] .getstunumber ());
System.out.println (" \ t \ t student name: "+ STU [A] .getName ());
System.out.println (" \ t \ t enter Higher math: ");
STU [A] .setmathematicsscore (in.nextDouble ());
System.out.println (" \ t \ t Higher math: "+ stu [a] .getmathematicsscore ());
System.out.println ( "\ t \ t enter a college English results:");
STU [A] .setenglishiscore (in.nextDouble ());
System.out.println ( "\ t \ t university English scores:" + STU [A] .getenglishiscore ());
System.out.println ( "\ t \ t enter the computer network performance:");
STU [A ] .setnetworkscore (in.nextDouble ());
System.out.println ( "\ T \ T computer network results:" STU + [A] .getnetworkscore ());
System.out.println ( "\ T \ T please input database results: ");
STU [A] .setdatabasescore (in.nextDouble ());
System.out.println (" \ T \ T database results: "STU + [A] .getdatabasescore ());
the System.out .println ( "\ t \ t enter the software engineering achievement:");
STU [A] .setsoftwarescore (in.nextDouble ());

System.out.println ( "\ t \ t software engineering achievement:" + stu [ A] .getsoftwarescore ());

System.out.println ( "grade has entered the student completed, whether to submit (the Y / N)");
String tijiao in.next = ();
//System.out.println(tijiao );
IF (tijiao.equals ( "the Y")) {
//display();
}
else {
STU [A] .setmathematicsscore (0);
STU [A] .setenglishiscore (0);
STU [A] .setnetworkscore (0);
STU [A] .setdatabasescore (0);
STU [A] .setsoftwarescore (0);
displayscorescan ();
}
System.out.println ( "************************************** ************************************************************ ");
}
static void Update () {
System.out.println (" ************ *********************************************** ");
System.out.println ( "\ t \ t Shijiazhuang Railway Institute of software Engineering student management system version 2019");
System.out.println ( "\ t \ t student test scores modification interface");
System.out.println ( "**************************** *********** ");
System.out.println (" \ t \ t enter the student number: \ t ");
System.out.println ( "******************************************* ********************************************************* ");

String str2 = in.next ();
int FLAG2 = 0;
for (int I = 0; I <. 5; I ++) {
IF (str2 .equals (STU [I] .getstunumber ())) {
System.out.println ( "**************************************************************** *********************************************************** ");
System.out.println (" \ t \ t software Engineering, Shijiazhuang Railway Institute student management system version 2019 ");
System.out.println (" \ t \ t student test scores entry ");
System.out.println (" **************** ******************************************* ");
System.out. println ( "\ t \ t student number:" + STU [i] .getstunumber ());
System.out.println ( "\ t \ t student name:" + STU [i] .getName ());
System .out.println ( "\ t \ t1, higher math:" STU + [I] .getmathematicsscore ());
the System.out.println ( "\ t \ t2, university English scores:" + stu ​​[i] .getenglishiscore ());
System.out.println ( "\ t \ t3, computer network performance:" STU + [I] .getnetworkscore ());
System.out.println ( "\ T \ T4, the database results:" + stu [i]. getdatabasescore ());
System.out.println ( "\ t \ T5, software engineering achievement:" + STU [i] .getsoftwarescore ());
System.out.println ( "Please enter the number corresponding to the subjects to be modified:" );
int in.nextInt B = ();
System.out.println ( "******************************** *************************** ");
System.out.println (" \ t \ t software Engineering, Shijiazhuang Railway Institute student management system version 2019 ");
System.out.println (" \ t \ t student test scores entry ");
System.out.println (" ******************* **************************************** ");
System.out.println (" \ t \ t student number: "+ STU [i] .getstunumber ());
System.out.println (" \ t \ t student name: "+ stu [i] .getname ());
double memorymath=stu[i].getmathematicsscore();
memoryenglish STU = Double [I] .getenglishiscore ();
Double memorynet STU = [I] .getnetworkscore ();
Double memorydata STU = [I] .getdatabasescore ();
Double memorysoft STU = [I] .getsoftwarescore ();
Switch ( B) {
Case. 1: System.out.println ( "Advanced Mathematics enter the edit results:");
STU [I] .setmathematicsscore (in.nextDouble ());
System.out.println ( "*** ************************************************** ****** ");
BREAK;
Case 2: System.out.println (" Please enter the result of the revised College English: ");
STU [i] .setenglishiscore (in.nextDouble ());
System. out.println ( "********************************************* ************** ");
BREAK;
Case. 3: System.out.println (" Please enter the results of the modified computer network: ");
STU [I] .setnetworkscore (in .nextDouble());
System.out.println ( "******************************************* ********************************************************* ");
BREAK;
Case. 4: System.out.println (" Please enter the modified score database: ");
STU [I] .setdatabasescore ( in.nextDouble ());
System.out.println ( "************************************ *********************** ");
; BREAK
Case 5: (System.out.println" Please enter the score after the modification of software engineering: ") ;

STU [I] .setsoftwarescore (in.nextDouble ());

System.out.println ( "**************************** ******************************* ");
BREAK;
}
System.out.println (" ****** ************************************************** *** ");
System.out.println (" \ t \ t Shijiazhuang Railway Institute of software Engineering student management system version 2019 ");
System.out.println (" \ t \ t student test scores entry ");
System.out.println ( "******************************************* ********************************************************* ");
System.out.println (" \ T \ T student number: "+ STU [I] .getstunumber ());
the System.out. println ( "\ t \ t student name:" + STU [i] .getName ());
System.out.println ( "\ t \ t higher mathematics achievement:" + STU [i] .getmathematicsscore ());
System .out.println ( "\ t \ t university English scores:" + STU [i] .getenglishiscore ());
System.out.println ( "\ t \ t computer network performance:" + stu [i] .getnetworkscore ( ));
System.out.println ( "\ t \ t database performance:" + stu [i] .getdatabasescore ());
System.out.println ( "\ t \ t software engineering achievement:" + stu [i] .getsoftwarescore ());
System.out.println ( "\ t \ t student achievement has been the modification is completed, whether or not to submit (the Y-/ N)");
String tijiao = in.next ();
iF (tijiao.equals ( " the Y ")) {
// the display ();
}
else {
if(b==1)
stu[i].setmathematicsscore(memorymath);
if(b==2)
stu[i].setenglishiscore(memoryenglish);
if(b==3)
stu[i].setnetworkscore(memorynet);
if(b==4)
stu[i].setdatabasescore(memorydata);
if(b==5)
stu[i].setsoftwarescore(memorysoft);
update();
}
System.out.println("***********************************************************");
flag2=1;
}
}
if(flag2==0) {
System.out.println("该学生不存在!");
update();
}
}
static double mathjd(int i) {
double mathjd=0;
if(stu[i].getmathematicsscore()>=90)
mathjd=4.0;
if(stu[i].getmathematicsscore()<=89.9&&stu[i].getmathematicsscore()>85)
mathjd=3.7;
if(stu[i].getmathematicsscore()<=84.9&&stu[i].getmathematicsscore()>82)
mathjd=3.2;
if(stu[i].getmathematicsscore()<=81.9&&stu[i].getmathematicsscore()>78)
mathjd=3.0;
if(stu[i].getmathematicsscore()<=77.9&&stu[i].getmathematicsscore()>75)
mathjd=2.7;
if(stu[i].getmathematicsscore()<=74.9&&stu[i].getmathematicsscore()>72)
mathjd=2.3;
if(stu[i].getmathematicsscore()<=71.9&&stu[i].getmathematicsscore()>68)
mathjd=2.0;
if(stu[i].getmathematicsscore()<=67.9&&stu[i].getmathematicsscore()>66)
mathjd=1.7;
if(stu[i].getmathematicsscore()<=65.9&&stu[i].getmathematicsscore()>64)
mathjd=1.5;
if(stu[i].getmathematicsscore()<=63.9&&stu[i].getmathematicsscore()>=60)
mathjd=1.0;
if(stu[i].getmathematicsscore()<60)
mathjd=0;
return mathjd;
}
static double englishjd(int i) {
double englishjd=0;
if(stu[i].getenglishiscore()>=90)
englishjd=4.0;
if(stu[i].getenglishiscore()<=89.9&&stu[i].getenglishiscore()>85)
englishjd=3.7;
if(stu[i].getenglishiscore()<=84.9&&stu[i].getenglishiscore()>82)
englishjd=3.2;
if(stu[i].getenglishiscore()<=81.9&&stu[i].getenglishiscore()>78)
englishjd=3.0;
if(stu[i].getenglishiscore()<=77.9&&stu[i].getenglishiscore()>75)
englishjd=2.7;
if(stu[i].getenglishiscore()<=74.9&&stu[i].getenglishiscore()>72)
englishjd=2.3;
if(stu[i].getenglishiscore()<=71.9&&stu[i].getenglishiscore()>68)
englishjd=2.0;
if(stu[i].getenglishiscore()<=67.9&&stu[i].getenglishiscore()>66)
englishjd=1.7;
if(stu[i].getenglishiscore()<=65.9&&stu[i].getenglishiscore()>64)
englishjd=1.5;
if(stu[i].getenglishiscore()<=63.9&&stu[i].getenglishiscore()>=60)
englishjd=1.0;
if(stu[i].getenglishiscore()<60)
englishjd=0;
return englishjd;
}
static double netjd(int i) {
double netjd=0;
if(stu[i].getnetworkscore()>=90)
netjd=4.0;
if(stu[i].getnetworkscore()<=89.9&&stu[i].getnetworkscore()>85)
netjd=3.7;
if(stu[i].getnetworkscore()<=84.9&&stu[i].getnetworkscore()>82)
netjd=3.2;
if(stu[i].getnetworkscore()<=81.9&&stu[i].getnetworkscore()>78)
netjd=3.0;
if(stu[i].getnetworkscore()<=77.9&&stu[i].getnetworkscore()>75)
netjd=2.7;
if(stu[i].getnetworkscore()<=74.9&&stu[i].getnetworkscore()>72)
netjd=2.3;
if(stu[i].getnetworkscore()<=71.9&&stu[i].getnetworkscore()>68)
netjd=2.0;
if(stu[i].getnetworkscore()<=67.9&&stu[i].getnetworkscore()>66)
netjd=1.7;
if(stu[i].getnetworkscore()<=65.9&&stu[i].getnetworkscore()>64)
netjd=1.5;
if(stu[i].getnetworkscore()<=63.9&&stu[i].getnetworkscore()>=60)
netjd=1.0;
if(stu[i].getnetworkscore()<60)
netjd=0;
return netjd;
}
static double datajd(int i) {
double datajd=0;
if(stu[i].getdatabasescore()>=90)
datajd=4.0;
if(stu[i].getdatabasescore()<=89.9&&stu[i].getdatabasescore()>85)
datajd=3.7;
if(stu[i].getdatabasescore()<=84.9&&stu[i].getdatabasescore()>82)
datajd=3.2;
if(stu[i].getdatabasescore()<=81.9&&stu[i].getdatabasescore()>78)
datajd=3.0;
if(stu[i].getdatabasescore()<=77.9&&stu[i].getdatabasescore()>75)
datajd=2.7;
if(stu[i].getdatabasescore()<=74.9&&stu[i].getdatabasescore()>72)
datajd=2.3;
if(stu[i].getdatabasescore()<=71.9&&stu[i].getdatabasescore()>68)
datajd=2.0;
if(stu[i].getdatabasescore()<=67.9&&stu[i].getdatabasescore()>66)
datajd=1.7;
if(stu[i].getdatabasescore()<=65.9&&stu[i].getdatabasescore()>64)
datajd=1.5;
if(stu[i].getdatabasescore()<=63.9&&stu[i].getdatabasescore()>=60)
datajd=1.0;
if(stu[i].getdatabasescore()<60)
datajd=0;
return datajd;
}
static double softjd(int i) {
double softjd=0;
if(stu[i].getsoftwarescore()>=90)
softjd=4.0;
if(stu[i].getsoftwarescore()<=89.9&&stu[i].getsoftwarescore()>85)
softjd=3.7;
if(stu[i].getsoftwarescore()<=84.9&&stu[i].getsoftwarescore()>82)
softjd=3.2;
if(stu[i].getsoftwarescore()<=81.9&&stu[i].getsoftwarescore()>78)
softjd=3.0;
if(stu[i].getsoftwarescore()<=77.9&&stu[i].getsoftwarescore()>75)
softjd=2.7;
if(stu[i].getsoftwarescore()<=74.9&&stu[i].getsoftwarescore()>72)
softjd=2.3;
if(stu[i].getsoftwarescore()<=71.9&&stu[i].getsoftwarescore()>68)
softjd=2.0;
if(stu[i].getsoftwarescore()<=67.9&&stu[i].getsoftwarescore()>66)
softjd=1.7;
if(stu[i].getsoftwarescore()<=65.9&&stu[i].getsoftwarescore()>64)
softjd=1.5;
if(stu[i].getsoftwarescore()<=63.9&&stu[i].getsoftwarescore()>=60)
softjd=1.0;
IF (STU [I] .getsoftwarescore () <60)
softjd = 0;
return softjd;
}
static Double averagejd (int K) {
Double Ave, HE1;
HE1 = mathjd (K) * + englishjd. 4 (K) +. 3 * netjd (K) * + datajd. 4 (K) * + softjd. 3 (K) * 2;
return HE1 / 16;
}
static void displayjd () {
System.out.println ( "********** ************************************************* " );
System.out.println ( "\ t \ t Shijiazhuang Railway Institute of software Engineering student management system version 2019");
System.out.println ( "\ t \ t student test scores to calculate grade point interface");
system .out.println ( "******************************************** *************** ");
System.out.println (" \ t \ t enter the student number: XXXXXXXXXXXX ");
System.out.println (" **** ************************************************** ***** ");
String str=in.next();
B1 = to true Boolean;
DecimalFormat DecimalFormat new new DF = ( "# 00.");
for (int I = 0; I <. 5; I ++) {
IF (str.equals (STU [I] .getstunumber ())) {
B1 to false =;
System.out.println ( "**************************************** ******************* ");
System.out.println (" \ t \ t Shijiazhuang Railway Institute of software Engineering student management system version 2019 ");
system. out.println ( "\ t \ t student test scores to calculate grade point interface");
System.out.println ( "************************ *********************************** ");
System.out.println (" \ t \ t student student ID: "+ STU [i] .getstunumber ());
System.out.println (" \ t \ t student name: "+ STU [i] .getName ());
System.out.println (" \ t \ t higher math scores for Grade point: "+ mathjd (i));
System.out.println (" \ t \ t in achievement Grade point Average: "+ englishjd (i));
System.out.println ( "\ t \ t GPA results computer network:" + netjd (i));
System.out.println ( "\ t \ t database grades Grade Point Average:" + datajd (i));
System.out.println ( "\ t \ t software engineering achievement grade point:" + softjd (i));
System .out.print ( "\ t \ t your grade point average:");
Double Ave2 = averagejd (i);
System.out.println (df.format (Ave2));
IF (averagejd (i)> = 2) {
System.out.println ( "\ t \ t message: you have reached Grade point graduation requirements!");
}
the else {
System.out.println ( "\ t \ t message: your credits GPA does not meet the requirements for graduation ");!
}
System.out.println (" \ t \ t student achievement has been the modification is completed, whether or not to submit (the Y-/ N) ");
String tijiao = in.next ();
iF ( tijiao.equals ( "the Y")) {
the display ();
}
the else {}
}
}
IF (B1) {
System.out.println ( "not the student!");
displayjd ();
}

}
static ScoreInformation[] stu=new ScoreInformation[10];
public static void main(String[] args) {
for(int i=0;i<10;i++)
stu[i]=new ScoreInformation();
stu[0].setstunumber("20183584");stu[0].setname("刘瑞阳");/*stu[0].setmathematicsscore(99);
stu[0].setenglishscore(98);stu[0].setnetworkscore(97);stu[0].setdatabasescore(96);
stu[0].setsoftwarescore(99);*/
stu[1].setstunumber("20183583");stu[1].setname("张志伟");/*stu[1].setmathematicsscore(99);
stu[1].setenglishscore(98);stu[1].setnetworkscore(97);stu[1].setdatabasescore(96);
stu[1].setsoftwarescore(99);*/
stu[2].setstunumber("20183585");stu[2].setname("刘云天");/*stu[2].setmathematicsscore(99);
stu[2].setenglishscore(98);stu[2].setnetworkscore(97);stu[2].setdatabasescore(96);
stu[2].setsoftwarescore(99);*/
stu[3].setstunumber("20183500");stu[3].setname("赵士通");/*stu[3].setmathematicsscore(99);
stu[3].setenglishscore(98);stu[3].setnetworkscore(97);stu[3].setdatabasescore(96);
stu[3].setsoftwarescore(99);*/
stu[4].setstunumber("20182600");stu[4].setname("马小");/*stu[4].setmathematicsscore(99);
stu[4].setenglishscore(98);stu[4].setnetworkscore(97);stu[4].setdatabasescore(96);
stu[4].setsoftwarescore(99);*/
boolean b1=true;
while(b1) {
display();
int num=in.nextInt();
switch(num) {
case 1:displayscorescan();
break;
case 2:update();
break;
case 3:displayjd();
break;
case 4:displayexit();
break;
}
}
}

}

 

 

 

// 20183584
// Liurui Yang
// Letter 1805-3 class
package scoreinformation;

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 saving umber;
}
Public void setstunumber (String saving umber) {
this.stunumber = saving umber;
}

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;
}

 

 

}

 

 

 

Screenshot:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Ideas: the definition of student information into a class, and then to another school achievement defined class. Gradually achieve different functions.

Guess you like

Origin www.cnblogs.com/aiyyue/p/11515524.html