簡(jiǎn)易的學(xué)生管理系統(tǒng)Java實(shí)現(xiàn)(數(shù)組)_第1頁(yè)
簡(jiǎn)易的學(xué)生管理系統(tǒng)Java實(shí)現(xiàn)(數(shù)組)_第2頁(yè)
簡(jiǎn)易的學(xué)生管理系統(tǒng)Java實(shí)現(xiàn)(數(shù)組)_第3頁(yè)
簡(jiǎn)易的學(xué)生管理系統(tǒng)Java實(shí)現(xiàn)(數(shù)組)_第4頁(yè)
簡(jiǎn)易的學(xué)生管理系統(tǒng)Java實(shí)現(xiàn)(數(shù)組)_第5頁(yè)
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、/學(xué)生管理類package test;public class StudentGuanli static Student student=new Student100;Scanner input=new Scanner(System.in);private static Scanner in2;/得到當(dāng)前數(shù)組中學(xué)生的數(shù)量int studentNum=this.getStudentNum();public int getStudentNum()int i=0;while(studenti!=null)i+;return i;/添加學(xué)生的方法public void addStudent(Stude

2、nt a)int c=0;for(int i=0;i<student.length;i+) if(studenti=null) 輸入學(xué)號(hào):");a.setStuno(input.nextLine();輸入姓名:");a.setName(input.nextLine();輸入數(shù)學(xué)成績(jī):");a.setMath(input.nextFloat();輸入英語(yǔ)成績(jī):");a.setEnglish(input.nextFloat();輸入電腦成績(jī):");a.setComputer(input.nextFloat(); for(int j=0;j&l

3、t;student.length;j+) if(studentj!=null) c+;studentc=a;添加成功!");break;/刪除學(xué)生的方法public void deleteStudent(String stuno)for(int i=0;i<=studentNum;i+)if(studenti.stuno.equals(stuno)刪除成功!");studenti=null;for(int j=i;j<student.length -1;j+)studentj=studentj+1; /將后面的值依次向前賦值 break;沒(méi)有此學(xué)號(hào)的學(xué)生!&qu

4、ot;);/查找學(xué)生的方法public void searchStudent(String stuno)for(int i=0;i<=studentNum;i+)if(studenti.stuno.equals(stuno)查找成功!");學(xué)號(hào): "+studenti.stuno+" 姓名: "++" 數(shù)學(xué)成績(jī):"+studenti.math+" 英語(yǔ)成績(jī):"+studenti.english+""+puter);break;else沒(méi)有此

5、學(xué)號(hào)學(xué)生!請(qǐng)重新查詢");/修改學(xué)生的方法public void alterStudent(String stuno,Student a)for(int i=0;i<=studentNum;i+)if(studenti.stuno.equals(stuno)修改后學(xué)號(hào):");a.setStuno(input.nextLine();修改后姓名:");a.setName(input.nextLine();修改后數(shù)學(xué)成績(jī):");a.setMath(input.nextFloat();修改后英語(yǔ)成績(jī):");a.setEnglish(input.n

6、extFloat();修改后電腦成績(jī):");a.setComputer(input.nextFloat();studenti=a;修改成功!");break;沒(méi)有此學(xué)號(hào)的學(xué)生!");/打印學(xué)生的方法public void printStudent()for(int i=0;i<=studentNum;i+)if(studenti!=null)學(xué)號(hào): "+studenti.stuno+" 姓名: "++" 數(shù) 學(xué) 成 績(jī) : "+studenti.math+" 英 語(yǔ) 成 績(jī)

7、 :"+studenti.english+" 電腦成績(jī)"+puter);/統(tǒng)計(jì)學(xué)生的方法public void infoStudent()int i=0;while(studenti!=null)i+;共用學(xué)生"+i+" 名 ");public static void main(String args) / TODO 自動(dòng)生成的方法存根/菜單:添加學(xué)生、刪除學(xué)生,查找學(xué)生、修改學(xué)生、打印學(xué)生/使用數(shù)組來(lái)實(shí)現(xiàn)對(duì)多個(gè)學(xué)生的管理歡迎使用學(xué)生管理系統(tǒng)");、添加學(xué)生n2、刪除學(xué)生n3、查詢學(xué)生n4、修改學(xué)生n

8、5、打印學(xué)生n6、統(tǒng)計(jì)學(xué) 生 ");boolean flag=true;while(flag)Student a=new Student();StudentGuanli d=new StudentGuanli();in2 = new Scanner(System.in);輸入你選擇的功能:");int s=in2.nextInt();switch(s)case 1:輸入你要添加學(xué)生的信息:");d.addStudent(a);break;case 2:輸入你要?jiǎng)h除的學(xué)生的學(xué)號(hào):");Scanner st=new Scanner(System.in);St

9、ring n=st.nextLine();d.deleteStudent(n);break;case 3:輸入你要查詢的學(xué)生的學(xué)號(hào):");Scanner st1=new Scanner(System.in);String hao=st1.nextLine();d.searchStudent(hao);break;case 4:輸入你要修改學(xué)生的學(xué)號(hào):");Scanner st2=new Scanner(System.in);String xiu=st2.nextLine();d.alterStudent(xiu, a);break;case 5:d.printStudent

10、();break;case 6:Student();break;感謝使用學(xué)生管理系統(tǒng)!");flag=false;break;/學(xué)生類package test;public class Student /學(xué)號(hào)、姓名、3 門課程“數(shù)學(xué)”、 “英語(yǔ)”和“計(jì)算機(jī)”的成績(jī),包括的方法有計(jì)算 3、 “平均分”、 “最高分”及“最低分”String stuno,name;float math,english,computer;public Student(String stuno,String name,float math,float english,float computer)

11、 this.stuno=stuno;=name;this.math=math;this.english=english;puter=computer;public Student() / TODO 自動(dòng)生成的構(gòu)造函數(shù)存根public void setStuno(String stuno) this.stuno=stuno;public void setName(String name) =name;public void setMath(float math) this.math=math;public void setEnglish(float engli

12、sh) this.english=english;public void setComputer(float computer) puter=computer;public String getStuno() return this.stuno;public String getName() return ;public float getMath() return math;public float getEnglish() return english;public float getComputer() return computer;public float sum()return math+english+computer;public float avg()return (math+english+computer)/3;public float max()if(math>english) if(math>computer) return math;elsereturn computer;elseif(en

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論