當前位置:首頁 » 編程語言 » java信息管理

java信息管理

發布時間: 2023-12-08 23:16:45

java實現學生簡易信息管理系統

importjava.util.*;
importjava.io.*;

classStuMgr{

publicstaticclassStudent{

publicintid;
publicStringname;
publicintage;

publicStudent(intid,Stringname,intage){
this.id=id;
this.name=name;
this.age=age;
}

@Override
publicStringtoString(){
returnid+","+name+","+age;
}
}

publicList<Student>stuList=newLinkedList<>();

publicvoidadd(){
Scannersc=newScanner(System.in);
System.out.println("請輸入學生學號:");
Stringid=sc.nextLine();
intintId=0;
try{
intId=Integer.parseInt(id);
}catch(NumberFormatExceptionex){
System.out.println("學號輸入有誤,請輸入數字!");
return;
}
if(find(intId)!=null){
System.out.println("該學號已經存在!");
return;
}
System.out.println("請輸入學生姓名:");
Stringname=sc.nextLine();
System.out.println("請輸入學生年齡:");
Stringage=sc.nextLine();
intintAge=0;
try{
intAge=Integer.parseInt(age);
}catch(NumberFormatExceptionex){
System.out.println("年齡輸入有誤,請輸入數字!");
return;
}
Studentstu=newStudent(intId,name,intAge);
stuList.add(stu);
store();
System.out.println("-----------------------");
System.out.println("學生信息已增加");
System.out.println(stu);
System.out.println("-----------------------");
}

publicvoiddel(){
Scannersc=newScanner(System.in);
System.out.println("請輸入學生學號:");
Stringid=sc.nextLine();
intintId=0;
try{
intId=Integer.parseInt(id);
}catch(NumberFormatExceptionex){
System.out.println("學號輸入有誤,請輸入數字!");
return;
}
Studentstu=find(intId);
if(stu==null){
System.out.println("該學號不存在!");
return;
}
stuList.remove(stu);
store();
System.out.println("-----------------------");
System.out.println("學生信息已刪除");
System.out.println(stu);
System.out.println("-----------------------");
}

publicvoidfind(){
Scannersc=newScanner(System.in);
System.out.println("請輸入學生學號:");
Stringid=sc.nextLine();
intintId=0;
try{
intId=Integer.parseInt(id);
}catch(NumberFormatExceptionex){
System.out.println("學號輸入有誤,請輸入數字!");
return;
}
Studentstu=find(intId);
if(stu==null){
System.out.println("該學號不存在!");
return;
}
System.out.println("-----------------------");
System.out.println("查找學生信息如下");
System.out.println(stu);
System.out.println("-----------------------");
}

publicStudentfind(intid){
for(Studentstu:stuList){
if(stu.id==id){
returnstu;
}
}
returnnull;
}

publicvoidmodify(){
store();
}

publicvoidforeach(){
System.out.println("-----------------------");
for(Studentstu:stuList){
System.out.println(stu);
}
System.out.println("-----------------------");
}

publicvoidstore(){
Iteratoriterator=stuList.iterator();
Filefile=newFile("stuList.txt");
FileWriterfw=null;
BufferedWriterwriter=null;
try{
fw=newFileWriter(file);
writer=newBufferedWriter(fw);
while(iterator.hasNext()){
writer.write(iterator.next().toString());
writer.newLine();//換行
}
writer.flush();
}catch(FileNotFoundExceptione){
e.printStackTrace();
}catch(IOExceptione){
e.printStackTrace();
}finally{
try{
writer.close();
fw.close();
}catch(IOExceptione){
e.printStackTrace();
}
}
}

publicstaticvoidmain(String[]args){
StuMgrmgr=newStuMgr();
while(true){
System.out.println("請選擇您要進行的操作:");
System.out.println("1:增加學生信息");
System.out.println("2:刪除學生信息");
System.out.println("3:查找學生信息");
System.out.println("4:修改學生信息");
System.out.println("5:遍歷學生信息");
System.out.println("6:退出");
System.out.println("-----------------------");
Scannersc=newScanner(System.in);
Stringop=sc.nextLine();
if("6".equals(op)){
return;
}
if("1".equals(op)){
mgr.add();
}
if("2".equals(op)){
mgr.del();
}
if("3".equals(op)){
mgr.find();
}
if("4".equals(op)){
mgr.modify();
}
if("5".equals(op)){
mgr.foreach();
}
}

}
}

時間倉促,還有一個modify方法沒實現,留給你自己練手。

㈡ 基於JAVA的學生信息管理系統

2、教學管理:教學信息管理模塊主要實現各種與教學相關信息的設置和維護的操作,包括以下幾方面的內容:院系設置、專業設置、年級設置、班級設置、學期設置、課程開設等 3、學籍管理:學生學籍管理模塊主要實現對學生基本信息的設置和維護,提供學生信息的錄入和查詢頁面,並對學生班級更改情況進行維護等,它包括以下幾方面的內容:學生基本信息維護和查詢、學生增減、批量導入學生信息並自動生成學號。 其中,學生基本信息的錄入、維護和查詢統計功能是每個學生必須完成的功能,而學生增減和批量導入學生信息並自動生成學號則是有能力的學生可以在時間充裕的前提下進一步完成。 4、成績管理:學生成績管理模塊主要實現對學生選修課程以及所選課程的成績信息的設置和維護。 它包括以下幾方面的內容:學生選課管理、學生成績管理兩部分。銷售管理系統的主要任務是建立、維護客戶信息檔案、統計、匯總產品信息,進行定單的錄入、維護等。要求編寫Java GUI程序實現上述功能。 3 課程設計報告書主要內容1 需求分析2 總體設計2.1 設計的總體思想與演算法描述 2.2 模塊結構圖 2.3 各功能模塊的功能與處理流程描述 2.4 界面設計 3 各功能模塊程序設計 按照功能模塊的功能與處理流程描述給出詳細的程序代碼,並給出重點語句的注釋. 4 小結4 課程設計要求 1 按時到機房簽到,在指定機位上機。遵守機房紀律。 2 獨立完成課程設計任務。指導教師到機位上指導學生和分時段驗收學生完成的程序。 3 按時提交列印的課程設計報告書。 5 課程設計參考書 1 許文憲 懂子建. Java程序設計教程與實訓 北京:北京大學出版社,2005. 2 辛運幃 .Java程序設計.北京:清華大學出版社, 2004 3 蔡翠平 .Java程序設計.北京:清華大學出版社,2003

熱點內容
安卓平板有什麼可以畫對稱的 發布:2024-07-27 09:36:03 瀏覽:132
羊創意腳本 發布:2024-07-27 09:29:30 瀏覽:894
榮耀v20升級存儲 發布:2024-07-27 09:20:19 瀏覽:485
安卓用什麼和電腦傳圖片 發布:2024-07-27 09:02:07 瀏覽:288
存儲過程就是 發布:2024-07-27 08:56:51 瀏覽:131
c語言高級試題 發布:2024-07-27 08:48:30 瀏覽:282
ip伺服器世界上有幾台 發布:2024-07-27 08:46:18 瀏覽:394
金立手機怎麼清理緩存 發布:2024-07-27 08:38:50 瀏覽:311
iphone文件夾不顯示 發布:2024-07-27 08:18:05 瀏覽:774
y510p固態硬碟做緩存 發布:2024-07-27 07:59:34 瀏覽:128