試験前のJavaクラス

デザインのアイデア:最初のパッケージを作成するには、パッケージに二つのクラス、ScoreInformation ScoreManagementクラスとクラスを設定します。7つのプライベート変数stunumber、名前、mathematicsscore、englishiscore、networkscore、databasescore、ScoreInformationクラスのsoftwarescoreの定義。そして、定義されてGET()(変数の情報を読んで)、及びSET()(変数の情報を設定し)、それらを達成するための方法で処理しました。

HH()関数を定義するScoreManagementクラスは、関数がアレイに定義され、その後、アレイは、生徒の名前、学生番号情報に格納されています。getstudent()関数を定義し、学生にすべての科目を入力するために使用されます。変更()関数の定義は、学生の情報を変更するために使用されます。定義jidian()関数は、スコアポイントに対応するスコアするために使用されます。最後に、HH()関数を呼び出し、getstudent()関数は、main関数で、変更()関数で、jidian()関数主な機能を設定します。

 

プログラムコード:

パッケージドゥアン;

パブリッククラスScoreInformation {
プライベート文字列stunumber。
プライベート文字列名;
プライベートダブルmathematicsscore。
プライベートダブルenglishiscore。
プライベートダブルnetworkscore。
プライベートダブルdatabasescore。
プライベートダブルsoftwarescore。

公共ScoreInformation(文字列stunumber、文字列名、ダブルmathematicsscore、ダブルenglishiscore、ダブルnetworkscore、ダブルdatabasescore、ダブルsoftwarescore){
// TODO自動生成コンストラクタスタブ
this.stunumber = stunumber。
this.name =名前;
this.mathematicsscore = mathematicsscore。
this.englishiscore = englishiscore。
this.networkscore = networkscore。
this.databasescore = databasescore。
this.softwarescore = softwarescore。

}
パブリック文字列getStunumber(){
戻りstunumber。
}
公共ボイドsetStunumber(文字列stunumber){
this.stunumber = stunumber。
}
パブリック文字列のgetName(){
戻り名。
}
公共ボイドのsetName(文字列名){
this.name =名。
}
公共ダブルgetMathematicsscore(){
戻りmathematicsscore。
}
公共ボイドsetMathematicsscore(ダブルmathematicsscore){
this.mathematicsscore = mathematicsscore。
}
公共ダブルgetEnglishiscore(){
戻りenglishiscore。
}
公共ボイドsetEnglishiscore(ダブルenglishiscore){
this.englishiscore = englishiscore。
}
公共ダブルgetNetworkscore(){
戻りnetworkscore。
}
公共ボイドsetNetworkscore(ダブルnetworkscore){
this.networkscore = networkscore。
}
公共ダブルgetDatabasescore(){
databasescoreを返します。
}
公共ボイドsetDatabasescore(ダブルdatabasescore){
this.databasescore = databasescore。
}
公共ダブルgetSoftwarescore(){
softwarescore返します。
}
公共ボイドsetSoftwarescore(ダブルsoftwarescore){
this.softwarescore = softwarescore。
}

}

 

パッケージドゥアン;
輸入duan.ScoreInformation。
輸入java.text.DecimalFormatの。
インポートjava.util.Scanner;
パブリッククラスScoreManagement {
静的てDecimalFormatのDF =新しいてDecimalFormat( "###### 0.00")。
静的ブールZ = TRUE。
静的ScoreInformation [] =新しいScoreInformation [5]。
静的ボイドHH(){
[0]新しいScoreInformation( "20183780"、 "段行0"、0,0,0,0,0)を=。
[1]新しいScoreInformationを=( "20183781"、 "段行1"、0,0,0,0,0)。
[2]新しいScoreInformationを=( "20183782"、 "段行2"、0,0,0,0,0)。
[3]新しいScoreInformationを=( "20183783"、 "段行3"、0,0,0,0,0)。
[4]新しいScoreInformationを=( "20183784"、 "段行4"、0,0,0,0,0)。
}

スキャナスキャナのスキャン=新しい新しい静的(System.in);
//生徒のテストの点数は、入力された
(静的ボイドgetstudentを){

System.out.printlnは(「******************* **************************************** ");
のSystem.out.println("石家荘、ソフトウェアエンジニアリングの学生管理システムのバージョン2019鉄道大学「);
System.out.printlnは(」生徒のテストの点数エントリ「);
System.out.printlnは(」************** **********************************************「);
システム.out.println( "学生番号を入力してください:XXXXXXXXを");
System.out.printlnは(「*************************** *********************************「);
文字列stunumber1 scan.next =();
falseにブール= O。
私はint型、
のために(I = 0;私は<5; Iは++){
IF(stunumber1.equals([I] .getStunumber())){
; O = trueに
ブレーク。
}
}
(O){IF
のSystem.out.println(「************************************** *********************「);
System.out.printlnは(」ソフトウェアエンジニアリングの学生管理システムの石家荘鉄道研究所バージョン2019「);
のSystem.out。 println( "生徒のテストの点数エントリ");
System.out.printlnは(「********************************* *************************** ");
のSystem.out.println("生徒番号「+ [I] .getStunumber( ) );
System.out.printlnは( "生徒名" + A [i]の.getName());
System.out.printlnは( "高い数学の成績を入力してください:");
([I] .setMathematicsscore(scan.nextDoubleを));
System.out.printlnは( "大学英語のスコアを入力してください:");
[i]を.setEnglishiscore(scan.nextDouble());
System.out.printlnはは( "大学のコンピュータネットワークのパフォーマンスを入力してください:");
[I] .setNetworkscore(scan.nextDouble());
のSystem.out。println(「データベースのパフォーマンスを入力してください:」);
[i]は.setDatabasescore(scan.nextDouble());
System.out.printlnは( "ソフトウェア工学の結果を入力してください:");
[i]を.setSoftwarescore(scan.nextDouble());
System.out.printlnは( 「************************************************* *********** ");

のSystem.out.println(" **************************************************************** ***********************************************************「);
System.out.printlnは(」ソフトウェア・エンジニアリング、石家荘鉄道研究所の学生管理システムバージョン2019 ");
System.out.printlnは("生徒のテストの点数エントリ");
System.out.printlnは(" ************************ ************************************ ");
System.out.printlnは("学生番号」 A + [I] .getStunumber());
System.out.printlnは( "学生名" A + [I] .getName());
System.out.printlnは( "学生番号" + [I] .getMathematicsscore ());
のSystem.out.println( "学生名「+ [I] .getEnglishiscore());
System.out.println( "生徒番号" + A [I] .getNetworkscore());
のSystem.out.println( "生徒名" A + [I] .getNetworkscore());
のSystem.out.println( "学生番号"+ A [I] .getSoftwarescore());
System.out.printlnは("(Y / Nを提出するかどうか、学生が完了入ったグレード) ");
System.out.printlnは(" **** ************************************************** ****** ");
文字列= n-scan.next();
IF(n.equals(" Y ")){
するSystem.out.println("成功したエントリ「);
}
他{
[I]。 setMathematicsscore(0);
[I] .setEnglishiscore(0);
[I] .setNetworkscore(0);
[I] .setDatabasescore(0);
[I] .setSoftwarescore(0);
のSystem.out.println ( "エントリが失敗しました");
}
}
他{するSystem.out.println( "再入力してください)、」入力エラーを;
}

}


静的ボイド変更パブリック(){
文字列のstunumber2;
System.out.printlnは(「********************************* ********************************* ");
のSystem.out.println("生徒テストの点数変更インターフェース「) ;
System.out.printlnは( "学生番号を入力してください");
System.out.printlnは(「*************************** ***************************************「);
stunumber2 scan.next =();
(; U <= 5; INT = 0 U U ++)のための{
(stunumber2.equals(A [U] .getStunumber())){IF
のSystem.out.println(「*********** ************************************************** *******「);
System.out.printlnは(」ソフトウェアエンジニアリングの学生管理システムの石家荘鉄道研究所バージョン2019「);
System.out.printlnは(」生徒のテストの点数エントリ「);
のSystem.out。 println( "************************************************** ****************** ");
System.out.println( "生徒番号:" + A [U] .getStunumber());

のSystem.out.println( "生徒名:" + A [U] .getName());

のSystem.out.println ( "より高い数学" + A [U] .getMathematicsscore());

のSystem.out.println( "大学英語スコア" + A [U] .getEnglishiscore());

のSystem.out.println(「コンピュータネットワークグレード: "A + [U] .getNetworkscore());

のSystem.out.println("データベースのパフォーマンス: "+ [U] .getDatabasescore());

のSystem.out.println("ソフトウェアエンジニアリングの達成:「+ [U ] .getSoftwarescore());
のSystem.out.println(「************************************ ******************************** ");

のSystem.out.println(" ******** ************************************************** **********「);
System.out.printlnは(」ソフトウェア工学の学生管理システムの石家荘鉄道研究所バージョン2019「);
のSystem.out。println(「生徒のテストの点数エントリ」);
System.out.println(「******************************************* ************************************************************ ");

のSystem.out.println("生徒番号:「+ [U] .getStunumber ()) ;

のSystem.out.println( "生徒名:" + A [U] .getName());

のSystem.out.println( "より高い数学");
[U] .setMathematicsscore(scan.nextDouble())。
System.out.println( "大学英語結果:");
[U] .setEnglishiscore(scan.nextDouble());
のSystem.out.println( "コンピュータネットワークのパフォーマンス");
[U] .setNetworkscore(スキャン。 nextDouble());
のSystem.out.println( "データベースのパフォーマンス");
[U] .setDatabasescore(scan.nextDouble());
のSystem.out.println( "ソフトウェアエンジニアリングの結果:");
[U]。 setSoftwarescore(scan.nextDouble());
System.out.printlnは( "************************************************** ****************** ");
System.out.println( "");
System.out.printlnは(「********************************* ***********************************「);
System.out.printlnは(」石家荘鉄道研究所のソフトウェア・エンジニアリング学生管理システムのバージョン2019の学科「);
System.out.printlnは(」生徒のテストの点数エントリ「);
System.out.printlnは(」******************* ************************************************* " );
のSystem.out.println( "生徒番号:" + A [U] .getStunumber());

のSystem.out.println( "生徒名:" + A [U] .getName());

のSystem.out .println( "より高い数学" + A [U] .getMathematicsscore());

のSystem.out.println( "大学英語スコア" + A [U] .getEnglishiscore());

のSystem.out.println(「コンピュータネットワーク結果: "A + [U] .getNetworkscore());

のSystem.out.println("データベースの検索結果:「+ [U] .getDatabasescore ())。

System.out.println( "ソフトウェア工学の成果:" + [U] .getSoftwarescore ());
9))2.7を返します。IF((A> = 72)&&(<= 74.9))2.3を返します。























IF((A> 68)&&(<= 71.9))2.0を返します。
IF((A> = 66)&&(<= 67.9))1.7を返します。
IF((A> = 64)&&(<= 65.9))1.5を返します。
IF((A> = 60)&&(<= 63.9))1.0を返します。
IF(<60)戻り0;
返します。

}


静的な無効メインパブリック(文字列[]引数){
trueにブール=ハング;
HH();
一方、(ハング)メインメニュー{//
するSystem.out.println(「************** ************************************************** ** ");
System.out.printlnは("ソフトウェア・エンジニアリング、石家荘鉄道研究所");
System.out.printlnは("学生管理システムのバージョン2019 ");
System.out.printlnは(" ****** ************************************************** ********** ");
のSystem.out.println(" *********************************************************** ************************************ ");
System.out.printlnは(" 1、学生のテストスコア-記録")
のSystem.out.println(" 2、生徒のテストの点数変更");
のSystem.out.println(" 3、生徒の成績グレードポイントを計算");
のSystem.out.println(" 4、学校の管理から撤退システム");
System.out.printlnは("************************************************** **************** ");

scan.nextInt scan_num = INT();
スイッチ(scan_num){//メインメニューを選択
。ケース1:
getstudent();
BREAK;
ケース2:
変更();
BREAK;
ケース3:
int型NUM = 0;
System.out.printlnは(「*********************************」);
System.out.printlnはソフトウェア工学(「石家荘鉄道研究所学生管理システムのバージョン2019の学科「);
System.out.printlnは(」グレード・ポイント・インタフェースを計算するために、生徒のテストの点数「);
System.out.printlnは(」**************** ******************************************************** ");
ダブルB2;
int型のX3 = 0;
しばらく(Z){
System.out.printlnは("学生番号を入力してください(数8サイエンス) :「);
文字列scan.nextのB =();
NUM <5;(NUM = 0 NUM ++)。
IF [NUM](.getStunumber()に等しい(B)){
ダブルC [] =新しい新しいダブル[ 5]、
C [0] = jidian NUM(A []。getMathematicsscore())。
C [1] = jidian([NUM] .getEnglishiscore());
C [2] = jidian(A [NUM] .getNetworkscore());
[3] C = jidian([NUM] .getDatabasescore()) ;
Cは= jidian([NUM] .getSoftwarescore())[4];
B2 =(C [0] + C [1] + C [2] + C [3] + C [4])/ 5;
X3 1 =;
のSystem.out.println( "*********************************");
のSystem.out。 println(「ソフトウェアエンジニアリングの学生管理システムの石家荘鉄道研究所バージョン2019」);
System.out.printlnは(「\ tの生徒のテストの点数グレード・ポイント・インタフェースを計算するために」);
System.out.printlnは(「****** *************************** ");
System.out.print(の"学生ID:「);
System.out.printlnは( [NUM] .getStunumber());
System.out.printの( "名")
のSystem.out.println [NUM](.getName());
System.out.printの(」1、数学で高性能。点:「);
のSystem.out.println(C [0])。
System.out.print( "2、達成Grade Point Averageを中:");
System.out.println(Cする[1]);
System.out.print(」3、コンピュータネットワークGPA結果: ")の;
のSystem.out.println(C [2]);
System.out.print(" 4。データベースの性能グレード点: ");
のSystem.out.println(C [3]);
System.out.print(" 5、ソフトウェアエンジニアリング達成グレード点:「);
のSystem.out.println(C [4]) ;
System.out.printの( "あなたのGPAがある:");
System.out.print(df.format(B2))の;
のSystem.out.println();
IF(B2> = 2)のSystem.out .println(「あなたのグレードポイントが卒業の要件に達している!」);
他のSystem.out.println(「あなたのグレードポイントが卒業の要件を満たしていない!」);
System.out.printlnは(「***** **************************** ");
のSystem.out.println「("メイン画面(Y / Nに戻るかどうか))。
一方、(Z){
文字列scan.next A1 =();
IF(a1.equals( "Y")){
BREAK。}

IF(X3 == 0){
するSystem.out.println( "不良に生徒番号!")。
BREAK;
}

}

}
BREAK;
}
BREAK;
ケース4:
のSystem.out.println(「************************************************************ **************************************************************** ");
System.out.printlnは(" ");
System.out.printlnは("生産:トレッキングドゥアン")を;
System.out.printlnは(" ");
System.out.printlnは(" ************************************************************ **********************************「);
ハン= falseに、
BREAK;
デフォルト:
System.out.printlnは( "エラーメッセージは、再入力してください");
BREAK;
}

}
}
}

 結果:

おすすめ

転載: www.cnblogs.com/hang-hang/p/11512799.html