软件工程-银行储蓄管理系统源代码(共13页)

上传人:Xgjmqtw****nqtwad... 文档编号:49683425 上传时间:2022-01-18 格式:DOCX 页数:13 大小:24.71KB
返回 下载 相关 举报
软件工程-银行储蓄管理系统源代码(共13页)_第1页
第1页 / 共13页
软件工程-银行储蓄管理系统源代码(共13页)_第2页
第2页 / 共13页
软件工程-银行储蓄管理系统源代码(共13页)_第3页
第3页 / 共13页
点击查看更多>>
资源描述
精选优质文档-倾情为你奉上package src.day01;public class ACC /父类 ,以下是共有属性和方法/卡号protected static long id; / 名字protected static String name; / 身份证protected static String personId; /电子邮件protected static String email; / 密码protected static long password; /余额protected static double balance; public ACC() public ACC(long id,String name,String personId,String email,long password,double balance )this.id = id;this.name = name;this.personId = personId;this.email = email;this.password = password;this.balance = balance;/ 存款方法public static void deposit(double money) balance += money; System.out.println(存款成功,你存入的金额为: + money); public long getId() return id;public void setId(long id) this.id = id;public String getName() return name;public void setName(String name) this.name = name;public String getPersonId() return personId;public void setPersonId(String personId) this.personId = personId;public String getEmail() return email;public void setEmail(String email) this.email = email;public long getPassword() return password;public void setPassword(long password) this.password = password;public double getBalance() return balance;public void setBalance(double balance) this.balance = balance;package src.day01;import java.util.*;public class Bank /先定义两个动态数组,其中ban用来存储借记卡数据,ba用来存储信用卡数据static Vector ban = new Vector();static Vector ba = new Vector();/i指借记卡卡号,每增加一个用户,i自增1/j指借记卡卡号,每增加一个用户,j自增1 private static long i = ; private static long j = ;public Bank() /判断用户办理借记卡还是信用卡的相关业务public static void justy(int ch)boolean k = true ;while(k) if(ch =1) System.out.println(你将要办理借记卡业务:); break;else if(ch =2) System.out.println(你将要办理信用卡业务:); break;else System.out.println(输入指令错误,请重新输入:); k=false;/开户方法 public static void register(int ch) justy(ch); Scanner re = new Scanner(System.in); System.out.println(请输入开户的用户名:); String na =re.next();long key; /两次密码不同的话循环 进行 p: while (true) System.out.println(请输入密码:); long pa = re.nextLong(); System.out.println(请再次输入密码:); long pa1 = re.nextLong(); if(pa=pa1 ) key = pa1; break ; else System.out.println(两次不相同,请重新输入); continue p; System.out.println(请输入身份证号:); String perId = re.next(); System.out.println(请输入email地址:); String em = re.next(); System.out.println(请输入开户金额:); double bal = re.nextDouble(); /存储和输出过程,将以上输入的正确数据存储到相应的数组中 if(ch=1) DebitAcc De = new DebitAcc(i,na,perId,em,key,bal); ban.add(De); System.out.println(恭喜你开户成功:你的卡号为 + i); i+; else if(ch=2) CreditAcc Cr = new CreditAcc(j,na,perId,em,key,bal); ba.add(Cr); System.out.println(恭喜你开户成功:你的卡号为 + j); j+; System.out.println( 用户名: + na ); System.out.println(身份证:+ perId ); System.out.println(email: +em ); System.out.println(开户金额: + bal ); /用户子菜单public static void MenuCu()Scanner sc = new Scanner(System.in);while(true)System.out.println(欢迎使用银行系统);System.out.println(请输入指令:1、开户 2 、登陆 3、退出到上级);int choice = sc.nextInt(); switch(choice) case 1: openAccount(); break; case 2: logIn(); break; case 3: return; default: System .out .println(输入指令错误,请重新输入); break; /开户方法总方法private static void openAccount()System.out.println(你将要办理开户业务:); System.out.println(请输入你要选择的银行卡类型: 1、借记卡 2、信用卡 ); Scanner op = new Scanner(System.in); int ch = op.nextInt(); register(ch); /用户登陆总方法public static void logIn( ) System.out.println(欢迎进入用户登陆界面,请选择你要登陆的卡号类型: 1、借记卡 2、 信用卡 ); boolean o = true; boolean p =false; Scanner lo = new Scanner(System.in); int ch = lo.nextInt(); justy(ch); l:while(o) System.out.println(请输入你的卡号:); long user = lo. nextLong(); if(ch=1) /调用对应数组的卡号群与输入卡号匹配,以下同理 for(int i = 0;iBank.ban.size();i+) DebitAcc d = (DebitAcc)Bank.ban.get(i); if(user = d.id) System.out.println(请输入密码:); long password = lo.nextLong(); /对密码进行正误判断,正则p为true,可向下进行,false则直接返回输入卡号命令,即只有输密码一次机会 p = pass(password) ; while(p) d.menu1(); break; else /卡号不存在进行的操作 System.out.println(该卡号不存在,是否重新输入:1、继续2、返回上一级); int c =lo.nextInt(); if(c=1) continue l; else return; else for(int j =0;jBank.ba.size();j+) CreditAcc c = (CreditAcc)Bank.ba.get(j); if(user=c.id) System.out.println(请输入密码:); long password = lo.nextLong(); p = pass(password) ; while(p) c.menu1(); break; else System.out.println(该卡号不存在,请重新输入:); continue l; /密码正误判断方法public static boolean pass( long password)if(password !=DebitAcc.password)System.out.println(密码错误!重新输入:);return false;elsereturn true;/管理员操作菜单public static void menuAd()Scanner mc = new Scanner(System.in);while(true)System.out.println(欢迎使用银行系统);System.out.println(请输入指令:1、查看所有用户余额 2 、查看信用卡用户总信用额度 3、退出到上级);int m =mc.nextInt();switch(m)case 1:checkBalance();break;case 2:checkCeiling();break;case 3:return;default:System.out.println(输入错误,请重试:); break;/营业员查询总余额public static void checkBalance()double k =0.0;for(int i = 0;iBank.ban.size();i+)DebitAcc d = (DebitAcc)Bank.ban.get(i); k += d.balance; for(int j=0;jBank.ba.size();j+)CreditAcc c = (CreditAcc)Bank.ba.get(j); k+=c.balance;System.out.println(本银行账户的总余额为: + k);public static void checkCeiling()double k =0.0;for(int j=0;jbalance)System.out.println(你的余额已不足,是否透支?1.透支 2.不透支); Scanner cr = new Scanner (System.in); int c = cr.nextInt(); switch(c) case 1: if(ceiling + balance balance)System.out.println(你的余额已不足,无法透支,请你重新输入:);return; balance-=money; /查询方法 public static void show() System.out.println(姓名: +name + 卡号: + id); System.out.println(你的余额为: + balance); package src.day01;public class Welbank /* * param args */public static void main(String args) / 银行系统主方法 Bank bank = new Bank(); bank. menuWel(); 专心-专注-专业
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 教学培训


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!