驾驶证管理吴红岩.docx
- 文档编号:16679651
- 上传时间:2023-07-16
- 格式:DOCX
- 页数:32
- 大小:208.67KB
驾驶证管理吴红岩.docx
《驾驶证管理吴红岩.docx》由会员分享,可在线阅读,更多相关《驾驶证管理吴红岩.docx(32页珍藏版)》请在冰点文库上搜索。
驾驶证管理吴红岩
驾驶证管理系统
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.1License类的声明(省略函数体)
publicclassLicense{
privatelongno;//身份证号
privateStringname;//姓名
privateStringtype;//类型
privateStringdate;//发证日期
privateintexpiry;//有效日期
publicLicense(longno,Stringname,Stringtype,Stringdate,intexpiry);
publiclonggetNo();
publicStringgetName();
publicStringgetDate();
publicintgetExpiry();
publicvoidsetType(Stringtype);
publicvoidsetExpiry(intexpiry);
publicStringgetType();
publicvoidsetNo(longno);
publicvoidsetName(Stringname);
publicvoidsetDate(Stringdate);
publicStringtoString();
}
2.2.2LicenseManager类的声明
publicclassLicenseManager{
staticintnum=0;
staticList
publicstaticvoidmain(String[]args);//测试方法
staticintregister(Licenselc);//注册
staticintcancel(longno);//注销
staticLicenselookup(longno);//查找
staticintextendExpiry(longno,intex);//延长有效期
}
2.2.3UserInterface类的声明
publicclassUserInterfaceextendsJFrameimplementsActionListener{
privatestaticfinallongserialVersionUID=1L;
JLabelb_title=newJLabel("驾驶证管理系统");
JButtonb_register=newJButton("注册");
JButtonb_search=newJButton("查找");
JButtonb_cancel=newJButton("注销");
JButtonb_extendExpiry=newJButton("延长有效期");
publicUserInterface();
publicvoidLaunchUserInterface();//启动整个系统的界面
publicvoidactionPerformed(ActionEvente);
}
2.2.4Search类的声明
publicclassSearchextendsJFrameimplementsActionListener{
privatestaticfinallongserialVersionUID=1L;
JTextFieldt_no;
JButtonb_submit;
JButtonb_goBack;
Licenselicense=null;
JPanelp;
Search();
voidshowResult();
publicvoidactionPerformed(ActionEvente);
}
2.2.5Register类的声明
publicclassRegisterextendsJFrameimplementsActionListener{
privatestaticfinallongserialVersionUID=1L;
JTextFieldt_no;
JTextFieldt_name;
JTextFieldt_type;
JTextFieldt_date;
JTextFieldt_period;
Register();
publicvoidactionPerformed(ActionEvente);
}
2.2.6、Cancel类的声明
publicclassCancelextendsJFrameimplementsActionListener{
privatestaticfinallongserialVersionUID=1L;
JPanelp;
JTextFieldt_no;
JButtonb_submit;
JButtonb_goBack;
JLabell;
Cancel();
publicvoidactionPerformed(ActionEvente);
}
2.2.7ExtendExpiry类的声明
publicclassExtendExpiryextendsJFrameimplementsActionListener{
privatestaticfinallongserialVersionUID=1L;
JPanelp;
JTextFieldt_no;
JTextFieldt_period;
JButtonb_submit;
JButtonb_goBack;
JLabell;
ExtendExpiry();
publicvoidactionPerformed(ActionEvente);
}
3功能实现(三号字、黑体)
3.1窗口显示
(1)运行程序,弹出主页面。
用户可选择进行何种操作。
主要包括注册、查找、注册、延长有效期四大功能。
(2)在主页面中点击注册按钮后,弹出注册面板。
驾驶证管理员可输入注册用户的身份证号、姓名、类型、发证日期、有效年限,点击提交完成注册功能。
(例如输入信息:
身份证号:
41282119920120221姓名:
张三类型:
C1发证日期:
20110123有效年限:
6)
(3)主面板中点击查找按钮,输入查询者的身份证号.
假若输入的身份证号为:
41282119920120221,点击确定按钮后,返回查询结果如下图所示:
(4)在主面板中点击注销按钮,弹出注销面板,输入要注销的身份证号,点击确定,完成注销功能。
(5)主页面中点击延长有效期按钮,弹出延长驾驶证有效年限面板。
输入要延长的身份证号,以及新的有效期,点击确定,完成功能。
3.2功能的实现情况
3.2.1、注册驾驶员信息模块
管理员点击注册按钮,调用newRegister()创建注册面板,输入驾驶证相关信息后newLicense()创建驾驶证对象,并把对象传递给LicenseManage类的register()方法,完成驾驶员对象的注册。
时序图如下:
3.2.2、查询驾驶证类型模块
管理员点击查询按钮,调用newSearchr()创建查询面板,在查询面板中输入要查询的身份证号,调用LicenseManager对象的lookup(no)方法,得到一个License对象。
在Search类中调用ShowResult()得到驾驶证的相关信息返回给用户。
时序图如下:
3.2.3、驾驶证注销模块
管理员点击注销按钮,调用newCancel()创建注销面板,在注销面板中输入要注销的身份证号,调用LicenseManager对象的cancel(no)方法,完成驾驶证的注销。
时序图如下:
3.2.4、延长有效期模块
管理员点击延长有效期按钮,调用newextendExpiry()创建注销面板,在该面板中输入要延长的身份证号,调用LicenseManager对象的extendExpiry(no)方法,完成驾驶证的延长有效期的功能。
时序图如下:
附录:
程序源代码
1.License类的详细代码:
publicclassLicense{
privatelongno;//身份证号
privateStringname;//姓名
privateStringtype;//类型
privateStringdate;//发证日期
privateintexpiry;//有效日期
publicLicense(longno,Stringname,Stringtype,Stringdate,intexpiry){
this.no=no;
this.name=name;
this.type=type;
this.date=date;
this.expiry=expiry;
}
publiclonggetNo(){
returnno;
}
publicStringgetName(){
returnname;
}
publicStringgetDate(){
returndate;
}
publicintgetExpiry(){
returnexpiry;
}
publicvoidsetType(Stringtype){
this.type=type;
}
publicvoidsetExpiry(intexpiry){
this.expiry=expiry;
}
publicStringgetType(){
returntype;
}
publicvoidsetNo(longno){
this.no=no;
}
publicvoidsetName(Stringname){
this.name=name;
}
publicvoidsetDate(Stringdate){
this.date=date;
}
publicStringtoString(){
Stringspace="";
return"身份证号:
"+no+space+"姓名:
"+name+space+"类型:
"+type
+space+"日期:
"+date+space+"有效年限:
"+expiry;
}
}
2.LicenseManage的详细代码
importjava.util.ArrayList;
importjava.util.Iterator;
importjava.util.List;
publicclassLicenseManager{
staticintnum=0;
staticList
publicstaticvoidmain(String[]args){
UserInterfaceui=newUserInterface();
ui.launchUserInterface();
}
staticintregister(Licenselc){//注册
list.add(lc);
num++;
returnnum;
}
staticintcancel(longno){//注销
List
booleanflag=false;
Iterator
while(i.hasNext()){//容器中是否还有下一个
Licenselicense=i.next();
if(license.getNo()==no){
list.remove(license);//把找到的对象从容器中删除
num--;
System.out.println("注销成功!
");
flag=true;
}
}
if(!
flag)
System.out.println("注销失败,您要注销的账号不存在!
");
returnnum;
}
staticLicenselookup(longno){//查找
Iterator
booleanflag=false;
while(i.hasNext()){
Licenselicense=i.next();
if(license.getNo()==no){
flag=true;
returnlicense;
}
}
if(!
flag){
System.out.println("**********norecord!
********");
}
returnnull;//查找失败
}
staticintextendExpiry(longno,intex){//延长有效期
Iterator
booleanflag=false;
while(i.hasNext()){
Licenselicense=i.next();
if(license.getNo()==no){
license.setExpiry(ex);
flag=true;
}
}
if(!
flag){
System.out.println("您要修改的记录不存在");
}
return1;
}
}
3、UserInterface类的详细代码:
importjava.awt.GridLayout;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjavax.swing.JButton;
importjavax.swing.JFrame;
importjavax.swing.JLabel;
importjavax.swing.JPanel;
publicclassUserInterfaceextendsJFrameimplementsActionListener{
privatestaticfinallongserialVersionUID=1L;
JLabelb_title=newJLabel("驾驶证管理系统");
JButtonb_register=newJButton("注册");
JButtonb_search=newJButton("查找");
JButtonb_cancel=newJButton("注销");
JButtonb_extendExpiry=newJButton("延长有效期");
publicUserInterface(){
super("欢迎来到驾驶证管理系统");
}
publicvoidlaunchUserInterface(){
this.setBounds(100,100,800,600);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
JPanelp=newJPanel();
p.setLayout(newGridLayout(5,1));
JPanelp1=newJPanel();
JPanelp2=newJPanel();
JPanelp3=newJPanel();
JPanelp4=newJPanel();
JPanelp5=newJPanel();
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);
}
publicvoidactionPerformed(ActionEvente){
if(e.getSource()==b_register){
newRegister();
}
elseif(e.getSource()==b_search){
newSearch();
}
elseif(e.getSource()==b_cancel){
newCancel();
}
elseif(e.getSource()==b_extendExpiry){
newExtendExpiry();
}
}
}
4.Search类的详细代码:
importjava.awt.BorderLayout;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjava.util.Vector;
importjavax.swing.JButton;
importjavax.swing.JFrame;
importjavax.swing.JLabel;
importjavax.swing.JPanel;
importjavax.swing.JScrollPane;
importjavax.swing.JTable;
importjavax.swing.JTextField;
publicclassSearchextendsJFrameimplementsActionListener{
privatestaticfinallongserialVersionUID=1L;
JTextFieldt_no;
JButtonb_submit;
JButtonb_goBack;
Licenselicense=null;
JPanelp;
Search(){
super("驾驶证管理系统");
this.setBounds(100,100,800,600);
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
p=newJPanel();
p.setLayout(null);
JLabell=newJLabel("查找");
l.setBounds(400,100,50,20);
p.add(l);
JLabell_no=newJLabel("身份证号:
");
t_no=newJTextField();
l_no.setBounds(300,150,100,20);
t_no.setBounds(400,150,150,20);
p.add(l_no);
p.add(t_no);
b_submit=newJButton("确定");
b_submit.setBounds(3
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 驾驶证 管理 红岩