JAV课程设计(论文)人事管理系统_第1页
JAV课程设计(论文)人事管理系统_第2页
JAV课程设计(论文)人事管理系统_第3页
JAV课程设计(论文)人事管理系统_第4页
JAV课程设计(论文)人事管理系统_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、目 录设计目的-1功能介绍-1程序流程-1设计步骤-2设计总结-6程序清单-8参考文献-14一、 设计目的通过课程设计,使学生提高理论联系实际解决实际问题的能力;也使学生对基于面向对象的理论进行系统设计过程中的诸多具体问题有感性的认识和深入的理解;进而提高学生的学习兴趣为其将来顺利进入毕业环节作必要的准备。由教师布置课程设计的题目与思路,学生每56人一个题目,按照教师给出的思路和计划进度安排独立完成课程设计,最后每人提交一份课程设计报告。二、 功能介绍该系统设计的五大功能:(1)具有新用户注册功能。(2)具有注册用户登录功能。(3)具有数据的录入功能。(4)具有数据查询功能,可以实现查询全部信

2、息和按条件执行查询。(5)具有按条件删除数据功能。(6)具有统计功能三、 程序流程四、 设计步骤 person类在person类中,除了构造方法外,还重载了tostring()方法。public string tostring()string s=id+ +name+ +sex+ +position+ +wage;return s;personnel类在personnel类中,有三个成员方法:添加:public void addperson(string id,string name,string sex,string position,string wage)plist.add(new pe

3、rson(id,name,sex,position,wage);删除:public void deleteperson(string id)it=plist.listiterator();while(it.hasnext()p=(person)it.next();if(p.id.equals(id)it.remove();break; 查询:public person seekperson(string id)p=null;it=plist.listiterator();while(it.hasnext()p=(person)it.next();if(p.id.equals(id)break;

4、elsep=null;return p;personjframe类在personjframe类中,构造方法设置整个界面的布局及界面上的标签、按钮、文本框,为按钮注册单击事件监听器,为列表框注册鼠标事件监听器。单击事件的事件处理程序由actionlistener接口中的actionperformed()方法实现,在该方法中进行按钮类的处理。当单击一个按钮时,java创建一个actionevent事件类对象e,并且自动执行actionperformed()方法,在actionperformed()方法体中,调用e.getsource()方法获得产生单击事件的事件源,即用户单击的是哪一个按钮,识别出

5、按钮后,则分别执行需要的操作。text.settext()方法设置文本行内容,combobox.setselecteditem()方法返回选中数据项对象,combobox.getselectedindex()方法返回选中数据项索引。鼠标事件的事件处理程序由mouseclicked()方法实现,单击列表框里面的内容即可在输入信息处显示信息。public void actionperformed(actionevent e) if(e.getsource()=add) if(!text_id.gettext().equals() string s=(string) combobox_sex.get

6、selecteditem(); string p=(string) combobox_position.getselecteditem(); personnel.addperson(text_id.gettext(),text_name.gettext(),s,p,text_wage.gettext(); list.setlistdata(personnel.plist.toarray(); if(e.getsource()=delete) personnel.deleteperson(text_id.gettext(); text_id.settext(); text_name.settex

7、t(); text_quantity.settext(); text_wage.settext(); list.setlistdata(personnel.plist.toarray(); if(e.getsource()=seek) string id=joptionpane.showinputdialog(请输入要查询的员工编号:); person theperson=personnel.seekperson(id); if(theperson=null) joptionpane.showmessagedialog(this,查无此人!,查询结果,joptionpane.warning_m

8、essage); else string s=; text_id.settext(theperson.id); text_name.settext(thep); combobox_sex.setselecteditem(theperson.sex); combobox_position.setselecteditem(theperson.position); text_wage.settext(theperson.wage); s=text_id.gettext()+text_name.gettext()+combobox_sex.getselecteditem()+ +c

9、ombobox_position.getselecteditem()+ +text_wage.gettext(); joptionpane.showmessagedialog(this,你要查询的员工信息:n+s,查询结果,joptionpane.information_message); if(e.getsource()=wagec) if(combobox_position.getselectedindex()=0) n=text_quantity.gettext(); i=double.parsedouble(n); w=4000+i*0.005; text_wage.settext(¥

10、+this.w); if(combobox_position.getselectedindex()=1) n=text_quantity.gettext(); i=double.parsedouble(n); w=2000+i*0.05; text_wage.settext(¥+this.w); if(combobox_position.getselectedindex()=2) if(combobox_perform.getselectedindex()=0) w=3000+1000; if(combobox_perform.getselectedindex()=1) w=3000+500;

11、 if(combobox_perform.getselectedindex()=2) w=3000; text_quantity.settext(); text_wage.settext(¥+this.w); if(e.getsource()=cancel) system.exit(0); 五、 设计总结这次的课程设计,是在学习了java以后通过阅读课本及在图书馆借阅相关书籍完成的。在开发这个系统的过程中,碰到很多或大或小的问题,我们一起思考,一起努力,最后大部分都解决了,得到了现在的这个简单的人事管理系统。 在编制过程中,我们首先考虑到了界面的友好性,并在界面设计时不采用烦琐的细节,使界面简

12、单、清晰,便于操作。一开始我们是想做个登录界面,实现用户的登录权限管理,但试了几次都没有达到预期的效果,最后不得不放弃。通过这次课程设计,我知道了什么事情都不那么简单,只有努力去做了,你才会有收获,不管收获大小,付出的过程总是有的。有些事情只有亲身感受,你才知道它的价值有多大。同时在遇到困难的时候要沉着冷静,首先要冷静分析问题,对于很难解决的问题要学会请教他人,还可以与别人合作。虽然这次课程设计付出了大量的时间,但是我知道我得到的收获远远不是这些时间可以衡量的,它将给我今后的学习和工作带来更多的收益。通过对此课题的开发,使我对用java开发系统有了一个比较清楚的认识,体会到理论和实践的重要性。

13、由于自己的分析设计和程序经验不足,该系统设计和实现过程中,还有许多没有完善的地方,比如没有设置登录界面,没有考虑到异常等多方面问题,这些都有待进一步完善和提高。对于文中出现的不足和系统中出现的问题敬请老师指导。六、 程序清单person类package mypackage;import java.util.*;public class person public string id,name,sex,position,wage;public person(string id,string na,string se,string po,string wa)id=id;name=na;sex=se

14、;position=po;wage=wa;public string tostring()string s=id+ +name+ +sex+ +position+ +wage;return s; personnel类package mypackage;import java.util.*;public class personnel public list plist=new arraylist();private listiterator it;private person p;public void addperson(string id,string name,string sex,st

15、ring position,string wage)plist.add(new person(id,name,sex,position,wage);public void deleteperson(string id)it=plist.listiterator();while(it.hasnext()p=(person)it.next();if(p.id.equals(id)it.remove();break;public person seekperson(string id)p=null;it=plist.listiterator();while(it.hasnext()p=(person

16、)it.next();if(p.id.equals(id)break;elsep=null;return p;personjframe类package mypackage;import java.awt.*;import java.awt.event.*;import javax.swing.*;public class personjframe extends jframe implements actionlistener private jlabel lab1,lab2,lab3,lab4,lab5,lab6,lab7,lab8; private jtextfield text_id,t

17、ext_name,text_quantity,text_wage; private jbutton add,delete,seek,cancel,wagec; private jcombobox combobox_sex,combobox_position,combobox_perform; private jpanel pan1,pan2; private jlist list; private personnel personnel=new personnel(); private string n; private double i,w=0; public personjframe()

18、super(简单人事管理系统(欢迎进入(*_*) ); this.setsize(500,350); this.setlocation(300,240); this.setdefaultcloseoperation(exit_on_close); this.setvisible(true); this.setlayout(new borderlayout(1,1); this.setresizable(false); list=new jlist(); this.add(list,borderlayout.west); list.setpreferredsize(new dimension(2

19、50,350); list.setlistdata(personnel.plist.toarray(); list.setselectionmode(listselectionmodel.single_selection); validate(); pan1 = new jpanel(new gridlayout(8,1); lab7=new jlabel(员工基本信息); pan1.add(lab7); lab8=new jlabel(输入基本信息); pan1.add(lab8); lab1=new jlabel(编号:); pan1.add(lab1); text_id=new jtex

20、tfield(10); pan1.add(text_id); lab2=new jlabel(姓名:); pan1.add(lab2); text_name=new jtextfield(10); pan1.add(text_name); lab3=new jlabel(性别:); pan1.add(lab3); object sex=男,女; combobox_sex= new jcombobox(sex); pan1.add(combobox_sex); lab4=new jlabel(职位:); pan1.add(lab4); object position=经理,销售人员,仓库管理员;

21、 combobox_position= new jcombobox(position); pan1.add(combobox_position); lab5=new jlabel(工作表现:); pan1.add(lab5); object perform=perfect,good,so-so; combobox_perform= new jcombobox(perform); pan1.add(combobox_perform); lab6=new jlabel(销售额/营业额:); pan1.add(lab6); text_quantity=new jtextfield(10); pan1

22、.add(text_quantity); wagec=new jbutton(工资:); pan1.add(wagec); text_wage=new jtextfield(10); pan1.add(text_wage); text_wage.seteditable(false); this.add(pan1,borderlayout.east); validate(); pan2=new jpanel(); add=new jbutton(添加); delete=new jbutton(删除); seek=new jbutton(查询); cancel=new jbutton(退出); p

23、an2.add(add); pan2.add(delete); pan2.add(seek); pan2.add(cancel); this.add(pan2,borderlayout.south); validate(); add.addactionlistener(this); delete.addactionlistener(this); seek.addactionlistener(this); cancel.addactionlistener(this); wagec.addactionlistener(this); list.addmouselistener(new mousead

24、apter() public void mouseclicked(mouseevent e) person theperson=(person)(list.getselectedvalue(); text_id.settext(theperson.id); text_name.settext(thep); combobox_sex.setselecteditem(theperson.sex); combobox_position.setselecteditem(theperson.position); text_wage.settext(theperson.wage); )

25、; public void actionperformed(actionevent e) if(e.getsource()=add) if(!text_id.gettext().equals() string s=(string) combobox_sex.getselecteditem(); string p=(string) combobox_position.getselecteditem(); personnel.addperson(text_id.gettext(),text_name.gettext(),s,p,text_wage.gettext(); list.setlistda

26、ta(personnel.plist.toarray(); if(e.getsource()=delete) personnel.deleteperson(text_id.gettext(); text_id.settext(); text_name.settext(); text_quantity.settext(); text_wage.settext(); list.setlistdata(personnel.plist.toarray(); if(e.getsource()=seek) string id=joptionpane.showinputdialog(请输入要查询的员工编号:

27、); person theperson=personnel.seekperson(id); if(theperson=null) joptionpane.showmessagedialog(this,查无此人!,查询结果,joptionpane.warning_message); else string s=; text_id.settext(theperson.id); text_name.settext(thep); combobox_sex.setselecteditem(theperson.sex); combobox_position.setselectedite

28、m(theperson.position); text_wage.settext(theperson.wage); s=text_id.gettext()+text_name.gettext()+combobox_sex.getselecteditem()+ +combobox_position.getselecteditem()+ +text_wage.gettext(); joptionpane.showmessagedialog(this,你要查询的员工信息:n+s,查询结果,joptionpane.information_message); if(e.getsource()=wagec) if(com

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论