学生信息管理java

学生信息管理java

ID:10972408

大小:38.50 KB

页数:4页

时间:2018-07-09

学生信息管理java_第1页
学生信息管理java_第2页
学生信息管理java_第3页
学生信息管理java_第4页
资源描述:

《学生信息管理java》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、/***AWTSampleapplication**@author*@version1.0012/05/06*/importjavax.swing.*;importjava.io.*;importjava.awt.*;importjava.awt.event.*;importjava.util.*;publicclassUnit{publicstaticvoidmain(String[]args){VectorstuList=newVector();Stringstu="",line="",input="",name="";booleanfl

2、ag=true;intvalue,age;line="请选择你要的操作1.增加学生2.修改学生信息3.删除学生4.浏览所有学生信息5.统计学生人数6.退出系统";while(flag){JOptionPane.showMessageDialog(null,line,"结果",JOptionPane.PLAIN_MESSAGE);input=JOptionPane.showInputDialog("请输入数字,选择你要的操作");value=Integer.parseInt(input);if(value==1){name=JOpt

3、ionPane.showInputDialog("请输入要添加的学生的名字:");age=Integer.parseInt(JOptionPane.showInputDialog("请输入要添加学生的年龄:"));studentStudent=newstudent(name,age);stuList.add(Student);/*Enumerationitems=stuList.elements();Objecto=items.nextElement();Studentsample=(Student)o;JOptionPane.showMes

4、sageDialog(null,sample.getName(),"结果",JOptionPane.PLAIN_MESSAGE);*/}elseif(value==2){name=JOptionPane.showInputDialog("请输入你要修改的学生的名字");input=JOptionPane.showInputDialog("请输入你要修改后的学生的年龄");age=Integer.parseInt(input);Enumerationitems=stuList.elements();while(items.hasMoreElem

5、ents()){//Stringnamestr=S;studentStu=(student)items.nextElement();if(Stu.getName().equals(name)){Stu.Update(age);break;}}JOptionPane.showMessageDialog(null,"修改成功!","结果",JOptionPane.PLAIN_MESSAGE);}elseif(value==3){name=JOptionPane.showInputDialog("请输入你要删除的学生的名字");Enumeratio

6、nitems=stuList.elements();while(items.hasMoreElements()){//Stringnamestr=S;studentStu=(student)items.nextElement();if(Stu.getName().equals(name)){stuList.remove(Stu);break;}}JOptionPane.showMessageDialog(null,"删除成功!","结果",JOptionPane.PLAIN_MESSAGE);}elseif(value==4){printVe

7、ctor(stuList);}elseif(value==5){JOptionPane.showMessageDialog(null,"学生人数是"+stuList.size(),"结果",JOptionPane.PLAIN_MESSAGE);}elseif(value==6){flag=false;}}}staticpublicvoidprintVector(Vectoroutput){Stringline="";if(output.isEmpty())JOptionPane.showMessageDialog(null,"Thevecto

8、risempty","结果",JOptionPane.PLAIN_MESSAGE);else{Enumerationitems=output.elements();

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。