JAV课程设计论文人事管理系统.doc

上传人:sccc 文档编号:4844360 上传时间:2023-05-19 格式:DOC 页数:14 大小:112.53KB
返回 下载 相关 举报
JAV课程设计论文人事管理系统.doc_第1页
第1页 / 共14页
JAV课程设计论文人事管理系统.doc_第2页
第2页 / 共14页
JAV课程设计论文人事管理系统.doc_第3页
第3页 / 共14页
JAV课程设计论文人事管理系统.doc_第4页
第4页 / 共14页
JAV课程设计论文人事管理系统.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《JAV课程设计论文人事管理系统.doc》由会员分享,可在线阅读,更多相关《JAV课程设计论文人事管理系统.doc(14页珍藏版)》请在三一办公上搜索。

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)

3、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)it.next();if(p.ID.

4、equals(id)break;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)

6、combobox_sex.getSelectedItem(); 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();

7、text_name.setText(); 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,查无此人!,查询结果,JOpti

8、onPane.WARNING_MESSAGE); else String s=; text_ID.setText(thePerson.ID); text_name.setText(thePerson.name); combobox_sex.setSelectedItem(thePerson.sex); combobox_position.setSelectedItem(thePerson.position); text_wage.setText(thePerson.wage); s=text_ID.getText()+text_name.getText()+combobox_sex.getSe

9、lectedItem()+ +combobox_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; tex

10、t_wage.setText(¥+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(

11、)=1) w=3000+500; 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=i

14、d;name=na;sex=se;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 na

15、me,String sex,String 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.ha

16、sNext()p=(Person)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 JTex

17、tField text_ID,text_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

18、 PersonJFrame() 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

19、(new Dimension(250,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);

20、text_ID=new JTextField(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 positio

21、n=经理,销售人员,仓库管理员; 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 JTex

22、tField(10); pan1.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=ne

23、w JButton(退出); pan2.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.addMouseList

24、ener(new MouseAdapter() public void mouseClicked(MouseEvent e) Person thePerson=(Person)(list.getSelectedValue(); text_ID.setText(thePerson.ID); text_name.setText(thePerson.name); combobox_sex.setSelectedItem(thePerson.sex); combobox_position.setSelectedItem(thePerson.position); text_wage.setText(th

25、ePerson.wage); ); 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()

26、; list.setListData(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.showInputDia

27、log(请输入要查询的员工编号:); 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(thePerson.name); combobox_sex.setSelectedItem(thePerson.sex); combobox_positio

28、n.setSelectedItem(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.g

29、etSource()=wageC) if(combobox_position.getSelectedIndex()=0) N=text_quantity.getText(); i=Double.parseDouble(N); w=4000+i*0.005; text_wage.setText(¥+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(

30、combobox_position.getSelectedIndex()=2) if(combobox_perform.getSelectedIndex()=0) w=3000+1000; if(combobox_perform.getSelectedIndex()=1) w=3000+500; if(combobox_perform.getSelectedIndex()=2) w=3000; text_quantity.setText(); text_wage.setText(¥+this.w); if(e.getSource()=cancel) System.exit(0); public

31、 static void main(String args) new PersonJFrame(); 七、 参考文献1.张海藩.软件工程导论.北京:清华大学出版社,2003。2.王要武.管理系统.北京:电子工业出版社,2003。3. 卢潇.软件工程.北京:清华大学出版社,2005。4.宋昆,李严.SQL Server数据库开发实例解析.北京:机械工业出版社,2006。5. 耿详义.JAVA2教程.北京:清华大学出版社,2004。6.张仿彦.JAVA项目开发全程实录.北京:清华大学出版社,2007。7. 杨小虎.软件工程课程设计.浙江:浙江大学出版社,2007。8. 韩万江.软件工程案例教程.北京:机械工业出版社,2007。9. 刘竹林,白振林,卢润彩.软件工程与项目管理.北京:北京师范大学出版社,2005。共 14 页 第 14 页

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 建筑/施工/环境 > 农业报告


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号