




已阅读5页,还剩17页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
驾驶证管理系统1 题目描述1.1 系统的功能需求 驾驶证信息包括:身份证号码、姓名、类型、发证日期、有效年限l驾驶证管理:(1) 支持驾驶证的注册(2) 支持驾驶证的注销(3) 支持驾驶证的查询(4)支持驾驶证有效期的延长(70岁可延长)1.2系统的功能详述 驾驶证管理系统可以进行驾驶员信息的注册、注销、查询、延长有效年限。驾驶证的注册:首先,用户完成相关课程的考核之后,驾驶证管理者可以进行驾驶证注册这个操作。用户提供个人信息:身份证号码、姓名,其他信息如驾驶证类型、发证日期、有效年限由驾驶证管理者根据实际情况录入。 驾驶证的注销:用户扣除分数超过12分或者主动要求注销驾驶证时,驾驶证管理者进行驾驶证注销的操作。输入待注销的驾驶员身份证号码,根据号码找到驾驶员信息,并进行删除。 驾驶证的查询:查询人员提供身份证号,驾驶证管理人员查询后可得到查询者驾驶证的所有信息包括:身份证号、姓名、类型、发证日期、有效年限。 驾驶证的修改:主要指驾驶证有效年限的修改,驾驶证管理人员根据驾驶员身份证号码,查询原始数据并将新数据更新。2类设计2.1 类图LicenseManage类:驾驶证管理类,管理驾驶证信息,包括注册、查询、注销、延长有效期。License类:驾驶证类,用于创建驾驶证对象,成员变量包括:身份证号、姓名、类型、日期、有效年限。UserInterface类:操作的主面板Register类:是驾驶员信息输入类,输入完整的驾驶证信息。ExtendExpiry类:延长驾驶证有效年限类。Cancel类:注销驾驶证的类。Search类:查询驾驶证信息的类。2.2 类声明2.2.1 License 类的声明(省略函数体)public class License private long no; /身份证号private String name; /姓名private String type; /类型private String date; /发证日期private int expiry; /有效日期public License(long no, String name, String type, String date, int expiry);public long getNo();public String getName();public String getDate();public int getExpiry();public void setType(String type);public void setExpiry(int expiry);public String getType();public void setNo(long no);public void setName(String name);public void setDate(String date);public String toString();2.2.2 LicenseManager 类的声明public class LicenseManager static int num = 0;static List list = new ArrayList();public static void main(String args); /测试方法static int register(License lc);/ 注册static int cancel(long no);/ 注销static License lookup(long no);/ 查找static int extendExpiry(long no, int ex);/ 延长有效期2.2.3 UserInterface类的声明public class UserInterface extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JLabel b_title = new JLabel(驾驶证管理系统);JButton b_register = new JButton(注册);JButton b_search = new JButton(查找);JButton b_cancel = new JButton(注销);JButton b_extendExpiry = new JButton(延长有效期);public UserInterface();public void LaunchUserInterface();/启动整个系统的界面public void actionPerformed(ActionEvent e); 2.2.4 Search类的声明public class Search extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JTextField t_no;JButton b_submit;JButton b_goBack;License license = null;JPanel p;Search();void showResult();public void actionPerformed(ActionEvent e);2.2.5 Register类的声明public class Register extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JTextField t_no;JTextField t_name;JTextField t_type;JTextField t_date;JTextField t_period;Register();public void actionPerformed(ActionEvent e);2.2.6、Cancel类的声明public class Cancel extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JPanel p;JTextField t_no;JButton b_submit;JButton b_goBack;JLabel l;Cancel() ;public void actionPerformed(ActionEvent e);2.2.7 ExtendExpiry类的声明public class ExtendExpiry extends JFrame implements ActionListenerprivate static final long serialVersionUID = 1L;JPanel p;JTextField t_no;JTextField t_period;JButton b_submit;JButton b_goBack;JLabel l ;ExtendExpiry();public void actionPerformed(ActionEvent e);3 功能实现(三号字、黑体)3.1 窗口显示(1)运行程序,弹出主页面。用户可选择进行何种操作。主要包括注册、查找、注册、延长有效期四大功能。(2)在主页面中点击注册按钮后,弹出注册面板。驾驶证管理员可输入注册用户的身份证号、姓名、类型、发证日期、有效年限,点击提交完成注册功能。(例如输入信息:身份证号:41282119920120221 姓名:张三 类型:C1 发证日期:20110123 有效年限:6)(3)主面板中点击查找按钮,输入查询者的身份证号.假若输入的身份证号为:41282119920120221,点击确定按钮后,返回查询结果如下图所示:(4)在主面板中点击注销按钮,弹出注销面板,输入要注销的身份证号,点击确定,完成注销功能。(5)主页面中点击延长有效期按钮,弹出延长驾驶证有效年限面板。输入要延长的身份证号,以及新的有效期,点击确定,完成功能。 3.2 功能的实现情况3.2.1、注册驾驶员信息模块管理员点击注册按钮,调用new Register()创建注册面板,输入驾驶证相关信息后new License()创建驾驶证对象,并把对象传递给LicenseManage类的register()方法,完成驾驶员对象的注册。时序图如下:3.2.2、查询驾驶证类型模块管理员点击查询按钮,调用new Searchr()创建查询面板,在查询面板中输入要查询的身份证号,调用LicenseManager对象的lookup(no)方法,得到一个License对象。在Search类中调用ShowResult()得到驾驶证的相关信息返回给用户。时序图如下:3.2.3、驾驶证注销模块管理员点击注销按钮,调用new Cancel()创建注销面板,在注销面板中输入要注销的身份证号,调用LicenseManager对象的cancel(no)方法,完成驾驶证的注销。时序图如下:3.2.4、延长有效期模块管理员点击延长有效期按钮,调用new extendExpiry()创建注销面板,在该面板中输入要延长的身份证号,调用LicenseManager对象的extendExpiry(no)方法,完成驾驶证的延长有效期的功能。时序图如下:附录:程序源代码1.License类的详细代码:public class License private long no; /身份证号private String name; /姓名private String type; /类型private String date; /发证日期private int expiry; /有效日期public License(long no, String name, String type, String date, int expiry) this.no = no; = name;this.type = type;this.date = date;this.expiry = expiry;public long getNo() return no;public String getName() return name;public String getDate() return date;public int getExpiry() return expiry;public void setType(String type) this.type = type;public void setExpiry(int expiry) this.expiry = expiry;public String getType() return type;public void setNo(long no) this.no = no;public void setName(String name) = name;public void setDate(String date) this.date = date;public String toString() String space = ;return 身份证号: + no + space + 姓名: + name + space + 类型: + type+ space + 日期: + date + space + 有效年限: + expiry;2.LicenseManage 的详细代码import java.util.ArrayList;import java.util.Iterator;import java.util.List;public class LicenseManager static int num = 0;static List list = new ArrayList();public static void main(String args) UserInterface ui = new UserInterface();ui.launchUserInterface();static int register(License lc) / 注册list.add(lc);num+;return num;static int cancel(long no) / 注销List listbak = new ArrayList(list);boolean flag = false;Iterator i = listbak.iterator(); / 得到该容器的迭代器while (i.hasNext() / 容器中是否还有下一个License license = i.next();if (license.getNo() = no) list.remove(license); / 把找到的对象从容器中删除num-;System.out.println(注销成功!);flag = true;if (!flag)System.out.println(注销失败,您要注销的账号不存在!);return num;static License lookup(long no) / 查找Iterator i = list.iterator();boolean flag = false;while (i.hasNext() License license = i.next();if (license.getNo() = no) flag = true;return license;if (!flag) System.out.println(*no record!*);return null;/ 查找失败static int extendExpiry(long no, int ex) / 延长有效期Iterator i = list.iterator();boolean flag = false;while (i.hasNext() License license = i.next();if (license.getNo() = no) license.setExpiry(ex);flag = true;if (!flag) System.out.println(您要修改的记录不存在);return 1;3、UserInterface 类的详细代码:import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel; public class UserInterface extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JLabel b_title = new JLabel(驾驶证管理系统);JButton b_register = new JButton(注册);JButton b_search = new JButton(查找);JButton b_cancel = new JButton(注销);JButton b_extendExpiry = new JButton(延长有效期); public UserInterface()super(欢迎来到驾驶证管理系统);public void launchUserInterface() this.setBounds(100, 100,800, 600);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setResizable(false);JPanel p = new JPanel();p.setLayout(new GridLayout(5,1);JPanel p1 = new JPanel();JPanel p2 = new JPanel();JPanel p3 = new JPanel();JPanel p4 = new JPanel();JPanel p5 = new JPanel();b_register.addActionListener(this);b_search.addActionListener(this);b_cancel.addActionListener(this);b_extendExpiry.addActionListener(this);p1.add(b_title);p2.add(b_register);p3.add(b_search);p4.add(b_cancel);p5.add(b_extendExpiry);p.add(p1);p.add(p2);p.add(p3);p.add(p4);p.add(p5);this.add(p);public void actionPerformed(ActionEvent e) if(e.getSource()=b_register) new Register(); else if(e.getSource()= b_search) new Search(); else if(e.getSource()=b_cancel) new Cancel(); else if(e.getSource()=b_extendExpiry) new ExtendExpiry(); 4.Search类的详细代码:import java.awt.BorderLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.Vector;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTable;import javax.swing.JTextField;public class Search extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JTextField t_no;JButton b_submit;JButton b_goBack;License license = null;JPanel p;Search() super(驾驶证管理系统);this.setBounds(100, 100, 800, 600);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setResizable(false);p = new JPanel();p.setLayout(null);JLabel l = new JLabel(查找);l.setBounds(400, 100, 50, 20);p.add(l);JLabel l_no = new JLabel(身份证号:);t_no = new JTextField();l_no.setBounds(300, 150, 100, 20);t_no.setBounds(400, 150, 150, 20);p.add(l_no);p.add(t_no);b_submit = new JButton(确定);b_submit.setBounds(330, 450, 60, 30);b_submit.addActionListener(this);p.add(b_submit);b_goBack = new JButton(返回);b_goBack.setBounds(420, 450, 60, 30);b_goBack.addActionListener(this);p.add(b_goBack);this.add(p);void showResult() JScrollPane scrollPane = new JScrollPane(); / 支持滚动scrollPane.setBounds(200, 200, 500, 200);getContentPane().add(scrollPane, BorderLayout.CENTER);String columnNames = 身份证号, 姓名, 驾驶证类型, 发证日期, 有效年限 ;Vector columnNameV = new Vector(); / 获得表头for (int column = 0; column 5; column+) columnNameV.add(columnNamescolumn);Vector tableValueV = new Vector();for (int row = 0; row 1; row+) / 获得数据Vector rowV = new Vector();if (license = null) System.out.println(no record);break;for (int column = 0; column columnNames.length; column+) switch (column) case 0:rowV.add(license.getNo();break;case 1:rowV.add(license.getName();break;case 2:rowV.add(license.getType();break;case 3:rowV.add(license.getDate();break;case 4:rowV.add(license.getExpiry();break;tableValueV.add(rowV);t_no.setText();final JTable table = new JTable(tableValueV, columnNameV); / 自定义的表格scrollPane.setViewportView(table);p.add(scrollPane);public void actionPerformed(ActionEvent e) long no;if (e.getSource() = b_submit) / System.out.println(good job );no = Long.parseLong(t_no.getText();/ System.out.println(t_no.getText();license = LicenseManager.lookup(no);this.showResult(); else if (e.getSource() = b_goBack) this.setVisible(false);5.Register 类的详细代码:import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;public class Register extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JTextField t_no;JTextField t_name;JTextField t_type;JTextField t_date;JTextField t_period;Register() super(注册);this.setBounds(100, 100, 800, 600);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setResizable(false);JPanel p = new JPanel();p.setLayout(null);JLabel l = new JLabel(注册);l.setBounds(400, 100, 50, 20);p.add(l);/ 添加身份证号JLabel l_no = new JLabel(身份证号:);t_no = new JTextField();l_no.setBounds(300, 150, 100, 20);t_no.setBounds(400, 150, 150, 20);p.add(l_no);p.add(t_no);/ 添加姓名JLabel l_name = new JLabel(姓 名:);t_name = new JTextField();l_name.setBounds(300, 200, 100, 20);t_name.setBounds(400, 200, 150, 20);p.add(l_name);p.add(t_name);/ 驾驶证类型JLabel l_type = new JLabel(类 型:);t_type = new JTextField();l_type.setBounds(300, 250, 100, 20);t_type.setBounds(400, 250, 150, 20);p.add(l_type);p.add(t_type);/ 发证日期JLabel l_date = new JLabel(发证日期:);t_date = new JTextField();l_date.setBounds(300, 300, 100, 20);t_date.setBounds(400, 300, 150, 20);p.add(l_date);p.add(t_date);/ 有效年限JLabel l_period = new JLabel(有效年限:);t_period = new JTextField();l_period.setBounds(300, 350, 100, 20);t_period.setBounds(400, 350, 150, 20);p.add(l_period);p.add(t_period);/ 提交按钮JButton b = new JButton(提交);b.setBounds(400, 450, 60, 30);p.add(b);b.addActionListener(this);add(p);public void actionPerformed(ActionEvent e) long no = Long.parseLong(t_no.getText().trim();String name = t_name.getText();String type = t_type.getText();String date = t_date.getText();int expiry = Integer.parseInt(t_period.getText();License li = new License(no, name, type, date, expiry);LicenseManager.register(li);/ LicenseManage.show();this.setVisible(false);6.Cancel类的详细代码:import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;public class Cancel extends JFrame implements ActionListener private static final long serialVersionUID = 1L;JPanel p;JTextField t_no;JButton b_submit;JButton b_goBack;JLabel l;Cancel() super(驾驶证管理系统);this.setBounds(100, 100, 800, 600);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setResizable(false);p = new JPanel();p.setLayout(null);JLabel l = new JLabel(注销);l.setBounds(400, 100, 50, 20);p.add(l);JLabel l_no = new JLabel(请输入身份证号:);t_no = new JTextField();l_no.setBounds(270, 250, 130, 20);t_no.setBounds(400, 250, 150, 20);p.add(l_no);p.add(t_no);b_submit = new JButton(确定);b_submit.setBounds(330, 450, 60, 30);b_submit.addActionListener(this);p.add(b_submit);b_goBack = new JButton(返回);b_goBack.setBounds(420, 450, 60, 30);b_goBack.addActionListener(this);p.add(b_goBack);this.add(p);public void actionPerformed(ActionEvent e) long no;if (e.getSource() = b_goBack) this.setVisible(false); else if (e.getSource() = b_submit) if (t_no.getText() = null) l = new JLabel(您要删除的记录不存在,请仔细核对身份证号!);l.setBounds(300, 300, 100, 20);p.add(l); else no = Long.parseLong(t_no.getText();LicenseManager.cancel(no);t_no.setText();7.ExtendExpiry类的详细代码:import java.awt.event.ActionEvent;import java.awt.event.ActionLis
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 药品无人售货机营销方案
- 海边沙滩施工方案怎么写
- 咨询目标及咨询方案模板
- 长春网站建设方案咨询
- 清明线下活动策划方案
- 门市咨询方案设计
- 数据中心机房冷通道管理系统技术方案
- 时间小管家青少年小组计划书
- 绿海甜园三期绿色施工方案
- 旅游景区营销促销活动方案
- 吉利汽车2025年并购后的企业转型与市场竞争力提升报告
- 煤气罐起火安全培训课件
- 攀岩课件教学课件
- GB/T 46150.1-2025锅炉和压力容器第1部分:性能要求
- 食品肉类供货合同范本
- SPSS操作课件教学课件
- 房屋土地兄弟分家协议书
- 四人合伙股份合同协议书
- 2021-2025年高考地理真题知识点分类汇编之宇宙中的地球
- 2025北京京剧院招聘工作人员10人备考试题及答案解析
- 中医药现代化国际市场拓展:2025年中医药国际市场竞争力提升策略报告
评论
0/150
提交评论