91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 5KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-18
  • 語言: 其他
  • 標簽: 初學代碼??

資源簡介

簡單的代碼 期末作業本人做的可以滿足剛接觸的學生完成期末作業

資源截圖

代碼片段和文件信息

import?java.util.Scanner;
//....................創建方法及屬性.............................................................
class?Student{
Scanner?input?=?new?Scanner?(System.in);

String?sno?;/*學號*/
????String?name?;/*姓名*/
????String?garder?;/*性別*/
String?Class?;/*班級*/
String?Number?;/*暫存成績錄入學號字符串*/
String?Number1?;/*暫存基本信息錄入學號字符串*/
int?age;/*年齡*/
????int?N;
????Float?English?=?(float)0;/*英語成績*/
????Float?Chinese?=?(float)0;?/*語文成績*/
????Float?Math?=?(float)0;/*數學成績*/
????Float?Physics?=?(float)0;/*物理成績*/
Float?Chemistry?=?(float)0;/*化學成績*/
Float?average?=?(float)0;/*五科平均分*/
????Float?count?=?(float)0;/*總分*/
int?Rank;/*排名*/

//存入學號取得學號
?public?void?setsno(String?sno)
?{
//用于限制學號的字符為長度2的字符并且學號的值不超過班級人數
?if?(sno.length()?==?2?&&?(((int)sno.charAt(0)-48)*10)+(int)(sno.charAt(1)-48)<=?N+48)
?{
?this.sno?=?sno;
?}
?while?(sno.length()?!=?2?||(((int)sno.charAt(0)-48)*10)+(int)(sno.charAt(1)-48)>?N)
?{
?System.out.println(“輸入的學號不符合字符要求(例?01)并且輸入的學號不大于班級人數“+N);
?System.out.println(“請重新輸入學號:“);
?sno?=?input.next();
?this.sno?=?sno;
?}
?}
?public?String?getsno()
?{
?return?sno;
?}
?
?//存入年齡取得年齡
?public?void?setage(int?age)
?{
//用于限制年齡的值在正常年齡范圍以內
?if?(age>=0&&age<=120)
?{
?this.age?=?age;
?}
?while?(age<0||age>120)
?{
?System.out.println(“系統檢測到輸入的年齡不符合實際情況(年齡小于0歲或年齡大于120歲)“);
?System.out.println(“請輸入符合實際的年齡(0到120之間包括0和120)“);
?age?=?input.nextInt();
?}
?}
?public?int?getage()
?{
?return?age;
?}

?//存入英語取得英語
?public?void?setEnglish(float?English)
?{
//用于限制英語成績的范圍
?if?(English>=0&&English<=120)
?{
?this.English?=?English;
?}
?while?(English<0||English>120)
?{
?System.out.println(“系統檢測到輸入分數不符合實際情況(分數小于0分或分數大于120分)“);
?System.out.println(“請輸入符合實際的英語成績(0分到120分之間包括0分和120分)“);
?English?=?input.nextFloat();
?this.English?=?English;
?}
?}
?public?float?getEnglish()
?{
return?English;
?}
?//存入語文取得語文
?public?void?setChinese(float?Chinese)
?{
//用于限制語文成績的范圍
?if?(Chinese>=0&&Chinese<=120)
?{
?this.Chinese?=?Chinese;
?}
?while?(Chinese<0||Chinese>120)
?{
?System.out.println(“系統檢測到輸入分數不符合實際情況(分數小于0分或分數大于120分)“);
?System.out.println(“請輸入符合實際的語文成績(0分到120分之間包括0分和120分)“);
?Chinese?=?input.nextFloat();
?this.Chinese?=?Chinese;
?}
?}
?public?float?getChinese()
?{
?return?Chinese;
?}
?//存入數學取得數學
?public?void?setMath(float?Math)
?{
//用于限制數學成績的范圍
?if?(Math>=0&&Math<=120)
?{
?this.Math?=?Math;
?}
?while?(Math<0||Math>120)
?{
?System.out.println(“系統檢測到輸入分數不符合實際情況(分數小于0分或分數大于120分)“);
?System.out.println(“請輸入符合實際的數學成績(0分到120分之間包括0分和120分)“);
?Math?=?input.nextFloat();
?this.Math?=?Math;
?}
?}
?public?float?getMath()
?{
?return?Math;
?}
?//存入物理取得物理
?public?void?setPhysics(float?Physics)
?{
//用于限制物理成績的范圍
?if?(Physics>=0&&Physics<=100)
?{
?this.Physics?=?Physic

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????25493??2018-06-22?21:06??07楊俊朗\Ma.java

?????目錄??????????0??2018-06-22?21:08??07楊俊朗

-----------?---------??----------?-----??----

????????????????25493????????????????????2


評論

共有 條評論

相關資源