Java-ATM管理系统.doc_第1页
Java-ATM管理系统.doc_第2页
Java-ATM管理系统.doc_第3页
Java-ATM管理系统.doc_第4页
Java-ATM管理系统.doc_第5页
已阅读5页,还剩27页未读 继续免费阅读

下载本文档

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

文档简介

合肥学院计算机科学与技术系面向对象综合设计报告20152016学年第一学期设计名称自动取款机模拟程序学生姓名 学号 专业班级14级软件工程卓越班指导教师吴晓琴、夏竹青 2015 年 12 月目录 一、 前言.3二、 需求分析.31、 功能需求.32、 系统介绍.33、 开发背景.4三、 系统总体设计.43.1系统功能介绍图. 53.2系统数据流程图.5四、 系统详细设计.54.1功能模块详细设计.6五、 数据库设计. 26六、 编码与实现. 26演示界面. 27七、 设计体会. 317.1关键技术分析.317.2设计体会和收获.32八、 参考文献. .32前言通过课程设计,学生在下述各方面的能力应该得到锻炼:(1)进一步巩固、加深学生所学专业课程JAVA语言教程的基本理论知识,理论联系实际,进一步培养学生综合分析问题,解决问题的能力。 (2)全面考核学生所掌握的基本理论知识及其实际业务能力,从而达到提高学生素质的最终目的。 (3)利用所学知识,开发小型应用系统,掌握运用JAVA语言编写调试应用系统程序,训练独立开发应用系统,进行数据处理的综合能力。(4)对于给定的设计题目,如何进行分析,理清思路,并给出相应的数学模型。 (5)熟练掌握JAVA语言的GUI设计、数据库连接以及异常的使用,灵活运用各种类库。一、需求分析1. 功能介绍在PC机上的一个自动取款机的模拟程序,实现现实中取款机的大部分功能。2. 系统介绍程序分为两部分:管理端和客户端。(1) 管理端负责管理所有的银行卡,管理员(省略身份验证)可以增加和删除银行卡。1) 每张银行卡由卡号唯一标识,卡号由12位阿拉伯数字组成;2) 新增的银行卡密码均为“123456”,卡内金额均为0元;3) 只有管理员增加的银行卡才能登陆客户端;4)删除后的银行卡将不能再登陆客户端。(2)客户端负责常见的取款机操作。1) 客户端需要登陆,用户输入正确的银行卡号和密码,系统核对无误 后才能进行操作;3) 登陆后,用户可以进行查询余额、取款、存款和修改密码的操作;4) 修改密码时,用户需输入两次新密码,确定无误后方可更改;5) 取款和存款操作,有操作结果提示,如“操作成功”或“余额不足,操作失败”等。3. 开发背景ATM自动取款机系统是银行业务流程过程中十分重要且必备的环节之一,在银行业务流程当中起着承上启下的作用,其重要性不言而喻。但是,目前许多银行在具体的一些业务流程处理过程中仍然使用手工操作的方式来实施,不仅费时、费力,效率低下,而且无法达到理想的效果。二、系统总体设计1. 系统功能介绍图系统主页面管理员用户添加用户信息删除用户信息存款、取款、改密提交开户申请提交申请开户信息管理员查看申请2. 系统数据流程图管理员管理员表管理员界面用户登录用户信息表数据库用户界面退出程序添加删除取钱改密存钱主界面退出退出三、系统详细设计main主函数screen newsetlayout=new screen();newsetlayout.mainFram();创建一个screen类的对象,并且使用对象引用screen类中的mainFram方法。screen类l public void mainFram()fram = new Frame(银行管理系统);this.JFram_main();this.JFrame_admin();this.JFrame_user();this.admin_main();this.user_main();this.money_in();this.money_out();this.money_show();this.admin_001();this.admin_002();this.admin_003();this.zhuce001();this.admin_005();fram.setLayout(clt);fram.add(main_1, 001);fram.add(main_admin, 002);fram.add(main_user, 003);fram.add(admin_in, 004);fram.add(user_in, 005);fram.add(money1, 006);fram.add(money2, 007);fram.add(admin01, 008);fram.add(admin02, 009);fram.add(admin03, 010);fram.add(showmoney001, 011);fram.add(admin011, 012);fram.add(admin_0005, 013);fram.addWindowListener(new WindowAdapter() public void windowClosing(WindowEvent e) System.exit(0););fram.setSize(400, 300);fram.setLocation(400, 200);fram.setVisible(true);fram.setResizable(false);创建一个新的界面,fram = new Frame(银行管理系统),申明一个“银行管理系统”的容器fram,其他的界面使用的是卡片式布局,在这个方法下,同时申明了其他各个图形界面的面板容器,当申明了所有的容器是,卡片上布局就只会显示最上面的容器。固定了窗口的大小,并且设置窗口的大小是不可以变得,即窗口时固定的。l public void JFram_main()main_1 = new JPanel();main_1.setLayout(null);JLabel welcome_1 = new JLabel(欢迎进入合肥学院银行管理系统);welcome_1.setHorizontalAlignment(JLabel.CENTER);/ 创建三个按钮并添加监听器admin = new JButton(管理员);user = new JButton(用户);exit = new JButton(退出);admin.addActionListener(this);user.addActionListener(this);exit.addActionListener(this);/ 设置按钮的位置welcome_1.setBounds(40, 50, 300, 20);admin.setBounds(115, 85, 150, 25);user.setBounds(115, 115, 150, 25);exit.setBounds(115, 145, 150, 25);main_1.add(welcome_1);main_1.add(admin);main_1.add(user);main_1.add(exit);进入系统的主界面,main_1 = new JPanel(),创建一个新的面板容器,并在容器的中间添加一个标签,显示“欢迎进入合肥学院银行管理系统”之后就是添加用户、管理员和退出的按钮,为这三个按钮创建监听器和设置他们的位置。最后,将这些添加的东西添加到容器当中。l public void zhuce001()admin011 = new JPanel();admin011.setLayout(null);in_name = new JLabel(姓名:);in_name1 = new JTextArea();in_name1.setBounds(130, 50, 100, 20);in_name.setBounds(30, 50, 100, 20);in_id = new JLabel(卡号:);in_id1 = new JTextArea();in_id1.setBounds(130, 80, 100, 20);in_id.setBounds(30, 80, 100, 20);in_password = new JLabel(密码:);in_password1 = new JTextArea();in_password.setBounds(30, 110, 100, 20);in_password1.setBounds(130, 110, 100, 20);in_money = new JLabel(金额:);in_money1 = new JTextArea();in_money.setBounds(30, 140, 100, 20);in_money1.setBounds(130, 140, 100, 20);in_0010 = new JButton(确定);in_exit0 = new JButton(返回);in_0010.setBounds(30, 170, 100, 20);in_exit0.setBounds(130, 170, 100, 20);in_0010.addActionListener(this);in_exit0.addActionListener(this);admin011.add(in_name);admin011.add(in_name1);admin011.add(in_0010);admin011.add(in_exit0);此页面为用户提交一个申请开户的要求。当用户点击申请注册的按钮,直接跳转到这个界面,界面上只要求用户输入自己的姓名即可,之后点击注册,用户输入的信息直接回提交到数据库中。l public void JFrame_admin()main_admin = new JPanel();main_admin_welcome = new JLabel(管理员登录);main_admin.setLayout(null);main_admin_welcome.setBounds(40, 50, 300, 20);admin_name1 = new JLabel(账号:);admin_password1 = new JLabel(密码:);admin_name = new JTextArea();admin_password = new JTextArea();warring_1 = new Label( );admin_name.setText();admin_password.setText();admin_name1.setBounds(55, 85, 100, 20);admin_password1.setBounds(55, 115, 100, 20);admin_name.setBounds(85, 85, 100, 20);admin_password.setBounds(85, 115, 100, 20);warring_1.setBounds(55, 135, 100, 20);admin_exit = new JButton(退出);admin_1 = new JButton(确定);admin_exit.addActionListener(this);admin_1.addActionListener(this);admin_exit.setBounds(55, 190, 100, 20);admin_1.setBounds(55, 160, 100, 20);main_admin.add(main_admin_welcome);main_admin.add(admin_name1);main_admin.add(admin_name);main_admin.add(admin_password);main_admin.add(admin_password1);main_admin.add(admin_1);main_admin.add(admin_exit);main_admin.add(warring_1);管理员登录界面,main_admin_welcome为界面上显示的管理员登录的提示,在容器中添加显示账号、密码的标签,并且添加输入管理员账号和密码的文本框,设置他们的起始位置,最后创建“确定”“退出”按钮,同时为其创建监听器。这个容器中还有一个空白的文本域,其目的就是在用户点击确定按钮之后,输入的数据和数据库中的数据相比较,若是不相同,这将空白的文本域重置为提示,显示账号或密码错误,若是直接进入下一个界面,这文本域不变。l public void JFrame_user()main_user = new JPanel();main_user.setLayout(null);main_user_welcome = new JLabel(用户登录);main_user_welcome.setBounds(40, 50, 300, 20);user_name1 = new JLabel(卡号:);user_password1 = new JLabel(密码:);user_name = new JTextArea();user_password = new JTextArea();warring_2 = new Label();user_name1.setBounds(55, 85, 100, 20);user_password1.setBounds(55, 115, 100, 20);user_name.setBounds(85, 85, 100, 20);user_password.setBounds(85, 115, 100, 20);warring_2.setBounds(55, 135, 100, 20);user_exit = new JButton(退出);user_1 = new JButton(确定);zhuce=new JButton(注册);zhuce.setBounds(55,210,100,20);zhuce.addActionListener(this);user_exit.addActionListener(this);user_1.addActionListener(this);user_exit.setBounds(55, 180, 100, 20);user_1.setBounds(55, 150, 100, 20);main_user.add(main_user_welcome);main_user.add(user_name1);main_user.add(user_name);main_user.add(user_password);main_user.add(user_password1);main_user.add(user_1);main_user.add(user_exit);main_user.add(warring_2);main_user.add(zhuce);用户登录的界面,其中有要求用户输入的卡号和密码,下面就是三个按钮,确定、退出和注册。当用户没有卡号和密码的时候,就可以点击下面的按钮,来申请一个账号,但是这个注册只能先提交,等到管理员看的时,仅管理员可以给注册账户。l public void admin_main()admin_in = new JPanel();admin_in.setLayout(null);cunqiantixing=new JLabel(合肥学院银行);cunqiantixing.setBounds(50, 50, 200, 40);admin_entring = new JButton(添加);admin_delect = new JButton(删除);admin_show22 = new JButton(显示);admin_entring.setBounds(40, 250, 100, 20);admin_delect.setBounds(140, 250, 100, 20);admin_show22.setBounds(240, 250, 100, 20);admin_entring.addActionListener(this);admin_delect.addActionListener(this);admin_show22.addActionListener(this);admin_in.add(admin_entring);admin_in.add(admin_delect);admin_in.add(admin_show22);admin_in.add(cunqiantixing);管理员的办公页面,容器中显示的仅仅是用户的功能,添加信息、删除信息和查看和人提交了申请开户的姓名,当看到提交的申请开户信息,管理员现在可以添加信息。删除信息可以删除数据库中已经存储的账户,若没有,删除之后会提示删除失败。l public void user_main()user_in = new JPanel();user_in.setLayout(null);user_money_in = new JButton(存钱);user_money_out = new JButton(取钱);user_money_show = new JButton(余额);user_money_exit = new JButton(改密);show003=new JLabel();show003.setBounds(50,50,100,30);user_money_in.addActionListener(this);user_money_out.addActionListener(this);user_money_show.addActionListener(this);user_money_exit.addActionListener(this);user_money_in.setBounds(5, 5, 100, 50);user_money_out.setBounds(5, 220, 100, 50);user_money_show.setBounds(290, 5, 100, 50);user_money_exit.setBounds(290, 220, 100, 50);user_in.add(user_money_in);user_in.add(show003);user_in.add(user_money_out);user_in.add(user_money_show);user_in.add(user_money_exit);用户登录成功之后的界面。仅有的是四个按钮,分别是“存钱”“取钱”“余额”“改密”,即分别模拟实现了现实中取款机的存钱、取钱、改密码和查询余额的功能,show003这个文本域也是开始没有显示什么,但是之后执行这些按钮之后,若其中执行成功文本域会提示成功,否则会显示操作失败。l public void money_in()money1 = new JPanel();money1.setLayout(null);money1_show = new JLabel(请输入要存的金额:);money1_show.setBounds(100, 100, 200, 30);money1_1 = new JButton(确定);money1_1.addActionListener(this);money1_1.setBounds(100, 160, 100, 20);money1_2 = new JButton(返回);money1_2.addActionListener(this);money1_2.setBounds(200, 160, 100, 20);money1_01 = new JTextArea();money1_01.setBounds(100, 130, 200, 20);money1.add(money1_show);money1.add(money1_1);money1.add(money1_2);money1.add(money1_01);用户存钱容器,用户提交要存储的钱数,之后会提交到数据库中,在当前的余额上加上存储的金额,为现在的余额。l public void money_out()money2 = new JPanel();money2.setLayout(null);money2_show = new JLabel(请输入要取的金额:);money2_show.setBounds(100, 100, 200, 30);money2_1 = new JButton(确定);money2_1.addActionListener(this);money2_1.setBounds(100, 160, 100, 20);money2_2 = new JButton(返回);money2_2.addActionListener(this);money2_2.setBounds(200, 160, 100, 20);money2_01 = new JTextArea();money2_01.setBounds(100, 130, 200, 20);money2.add(money2_show);money2.add(money2_1);money2.add(money2_2);money2.add(money2_01);用户取钱的容器l public void money_show()showmoney001 = new JPanel();showmoney001.setLayout(null);showmoney1 = new JLabel(账户余额);showmoney1.setFont(new Font(宋体, Font.BOLD, 18);showmoney1.setBounds(100, 50, 100, 50);showmoney2 = new JLabel( );showmoney2.setBounds(100, 100, 100, 30);showmoney_return = new JButton(返回);showmoney_return.addActionListener(this);showmoney_return.setBounds(150, 230, 100, 20);showmoney001.add(showmoney1);showmoney001.add(showmoney2);showmoney001.add(showmoney_return);显示余额的容器l public void admin_001()admin01 = new JPanel();admin01.setLayout(null);in_name = new JLabel(姓名:);in_name1 = new JTextArea();in_name1.setBounds(130, 50, 100, 20);in_name.setBounds(30, 50, 100, 20);in_id = new JLabel(卡号:);in_id1 = new JTextArea();in_id1.setBounds(130, 80, 100, 20);in_id.setBounds(30, 80, 100, 20);in_password = new JLabel(密码:);in_password1 = new JTextArea();in_password.setBounds(30, 110, 100, 20);in_password1.setBounds(130, 110, 100, 20);in_money = new JLabel(金额:);in_money1 = new JTextArea();in_money.setBounds(30, 140, 100, 20);in_money1.setBounds(130, 140, 100, 20);in_001 = new JButton(确定);in_exit = new JButton(返回);in_001.setBounds(30, 170, 100, 20);in_exit.setBounds(130, 170, 100, 20);in_001.addActionListener(this);in_exit.addActionListener(this);admin01.add(in_name);admin01.add(in_name1);admin01.add(in_id);admin01.add(in_id1);admin01.add(in_password);admin01.add(in_password1);admin01.add(in_money);admin01.add(in_money1);admin01.add(in_001);admin01.add(in_exit);管理员添加信息容器,输入姓名、卡号、密码和金额,之后获取到输入的这四个值。执行SQL语句,将这些信息插入到数据库中。l public void admin_002()admin02 = new JPanel();admin02.setLayout(null);delect01 = new JLabel(请输入要删除的卡号:);delect01.setBounds(100, 100, 200, 30);delect001 = new JTextArea();delect001.setBounds(100, 150, 200, 30);delect1 = new JButton(确定);delect1.addActionListener(this);delect1.setBounds(100, 200, 100, 30);delect2 = new JButton(返回);delect2.addActionListener(this);delect2.setBounds(200, 200, 100, 30);admin02.add(delect001);admin02.add(delect01);admin02.add(delect1);admin02.add(delect2);管理员删除卡号的容器,输入卡号,获取输入的信息,之后就是查询数据库中和这个卡号相同的信息,若查找到,这删除这条记录,否则提示删除失败。l public void admin_003()admin03 = new JPanel();admin03.setLayout(null);show1 = new JLabel(旧密码);test1=new JTextArea();test2=new JTextArea();test3=new JTextArea();test1.setBounds(130,40,100,20);test2.setBounds(130,80,100,20);test3.setBounds(130,120,100,20);show1.setBounds(20,40,100,20);show2 = new JLabel(新密码);show2.setBounds(20,80,100,20);show3 = new JLabel(再输入一次);show3.setBounds(20,120,100,20);show4 = new JLabel(余额);show4.setBounds(310, 5, 80, 20);show_return = new JButton(确定);show_return.addActionListener(this);show_return.setBounds(150, 250, 100, 20);message = new TextField();admin03.add(show1);admin03.add(show2);admin03.add(show3);admin03.add(test1);admin03.add(test2);admin03.add(test3);/admin03.add(show4);admin03.add(show_return);admin03.add(message);改密码的功能。提示用户输入旧的密码,和两次新的密码,点击提交的时候,这时获取到输入的数据,传入数据库中,首先先判断输入的旧密码和数据库中的密码是否匹配,若匹配,执行判断两个新的密码是否一致,之久就是更新数据库中的密码,若第一次密码就不一致,提示用户改密码失败。l public void actionPerformed(ActionEvent e)String sss1=user_name.getText();String sss2=user_password.getText();if (e.getSource() = admin) clt.show(fram, 002);if (e.getSource() = user) clt.show(fram, 003);return;if (e.getSource() = admin_1) if (admin_name.getText().equals(123) & admin_password.getText().equals(123) clt.show(fram, 004); else warring_1.setText(账号或密码错误!);if (e.getSource() = admin_entring) / 管理员添加按钮clt.show(fram, 008);if (e.getSource() = admin_delect) / 管理员删除clt.show(fram, 009);if (e.getSource() = admin_show) / 管理员查看clt.show(fram, 010);if (e.getSource() = user_money_in) / 存钱clt.show(fram, 006);if (e.getSource() = user_money_out) / 取钱clt.show(fram, 007);if (e.getSource() = user_money_show) / 显示余额clt.show(fram, 011);int s22=newdata.money(sss1);String pp=Integer.toString(s22);showmoney2.setText(pp);if (e.getSource() = user_1) / 用户登录int ss=newdata.checkmessage(sss1);if(ss=1)clt.show(fram, 005);else if(ss=0)warring_2.setText(登录失败);clt.show(fram, 003);if (e.getSource() = in_exit | e.getSource() = delect2) clt.show(fram, 004);if (e.getSource() = in_001) / 插入信息s1=in_name1.getText();s2=in_id1.getText();s3=in_password1.getText();s4=in_money1.getText();int ss=newdata.insertmessage(s1, s2, s3, s4);if(ss=1)cunqiantixing.setText(添加成功);cunqiantixing.setFont(new Font(宋体, Font.BOLD, 30);newdata.delectmessage1(s1);clt.show(fram, 004);else if(ss=0)cunqiantixing.setText(添加失败);cunqiantixing.setFont(new Font(宋体, Font.BOLD, 30);clt.show(fram, 004);if(e.getSource()=delect1)String q1=delect001.getText();int ss=newdata.delectmessage(q1);if(ss=1)cunqiantixing.setText(删除成功);cunqiantixing.setFont(new Font(宋体, Font.BOLD, 30);clt.show(fram, 004);else if(ss=0)cunqiantixing.setText(删除失败);cunqiantixing.setFont(new Font(宋体, Font.BOLD, 30);clt.show(fram, 004);if(e.getSource()=money1_2)clt.show(fram, 005);if(e.getSource()=money2_2)clt.show(fram, 005);if(e.getSource()=showmoney_return)clt.show(fram, 005);if(e.getSource()=exit | e.getSource()=admin_exit | e.getSource()=user_exit)System.exit(0);if(e.getSource()=money1_1)String s11=money1_01.getText();/System.out.println(s11);int s22=newdata.moneyin(sss1,s11);if(s22=0)show003.setText(存钱失败);clt.show(fram, 005);else if(s22=1)show003.setText(存钱成功);clt.show(fram, 005);if(e.getSource()=money2_1) /取钱String s12=money2_01.getText();int s23=newdata.moneyout(sss1, s12);if(s23=1)show003.setText(取钱成功);clt.show(fram, 005);else if(s23=0)show003.setText(取钱失败);clt.show(fram, 005);if(e.getSource()=user_money_exit)clt.show(fram, 010);if(e.getSource() = show_return)String pp1=test1.getText();String pp2=test2.getText();String pp3=test3.getText();if(pp2.equals(pp3)System.out.println(pp1);System.out.println(pp2);System.out.println(pp3);int s333=newdata.pass(sss1, pp1,

温馨提示

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

最新文档

评论

0/150

提交评论