package SixthPackage;
public class TestBanking {
public static void main(String[] args)
{
Bank bank = new Bank();
bank.addCustomer(new Customer("麻*文"));
bank.addCustomer(new Customer("邵*"));
Customer cust1 = bank.getCustomer(1);
Customer cust2 = bank.getCustomer(2);
cust1.addAccount(new SavingAccount(10000.0, 2.1));
cust1.addAccount(new CheckingAccount(10000.0, 10000.0));
cust2.addAccount(new CheckingAccount(10000.0, 5000.0));
Account acc1 = cust1.getAccount(1);
System.out.println(cust1.getName() + "的1号账户余额是\t " + acc1.getBalance());
acc1.deposit(1000.0);
System.out.println(cust1.getName() + "的1号账户余额是\t" + acc1.getBalance());
acc1.withdraw(20000.0);
System.out.println(cust1.getName() + "的1号账户余额是\t" + acc1.getBalance());
acc1.withdraw(10000.0);
System.out.println(cust1.getName() + "的1号账户余额是\t" + acc1.getBalance());
CheckingAccount acc2 = (CheckingAccount)cust1.getAccount(2);
System.out.println(cust1.getName() + "的2号账户余额是\t" + acc2.getBalance() + " \t透支金额是:\t" + acc2.getOverdraft());
acc2.deposit(1000.0);
System.out.println(cust1.getName() + "的2号账户余额是\t" + acc2.getBalance() + " \t透支金额是:\t" + acc2.getOverdraft());
acc2.withdraw(20000.0);
System.out.println(cust1.getName() + "的2号账户余额是\t" + acc2.getBalance() + "\t透支金额是:\t" + acc2.getOverdraft());
acc2.withdraw(3000.0);
System.out.println(cust1.getName() + "的2号账户余额是\t" + acc2.getBalance() + "\t透支金额是:\t" + acc2.getOverdraft());
acc2.withdraw(10000.0);
System.out.println(cust2.getName() + "的2号账户余额是\t" + acc2.getBalance() + "\t透支金额是:\t" + acc2.getOverdraft());
CheckingAccount acc3 = (CheckingAccount)cust2.getAccount(1);
System.out.println(cust2.getName() + "的账户余额是\t" + acc3.getBalance() + " \t透支金额是:\t" + acc3.getOverdraft());
acc3.deposit(1000.0);
System.out.println(cust2.getName() + "的账户余额是\t " + acc3.getBalance() + "\t透支金额是:\t" + acc3.getOverdraft());
acc3.withdraw(20000.0);
System.out.println(cust2.getName() + "的账户余额是\t" + acc3.getBalance() + "\t透支金额是:\t" + acc3.getOverdraft());
acc3.withdraw(3000.0);
System.out.println(cust2.getName() + "的账户余额是\t" + acc3.getBalance() + "\t透支金额是:\t " + acc3.getOverdraft());
acc3.withdraw(10000.0);
System.out.println(cust2.getName() + "的账户余额是\t" + acc3.getBalance() + " \t透支金额是:\t " + acc3.getOverdraft());
}
}
絔宝
- 粉丝: 5379
- 资源: 4
最新资源
- 手套手势检测7-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 学生成绩链表处理-C语言实现学生成绩链表处理技术解析与应用
- html + css 淘宝网实战
- 手手势检测3-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 通讯录排序-使用Python实现通讯录多规则排序方法
- 数据库概念设计ER图练习题.doc
- 使用aws的s3协议实现全部云管理的如cos,oss的对象存储文件上传案例
- 基于Java web SSM框架的实验室管理系统(源码+数据库).zip
- ER图练习题答案.doc
- JESD209-5C LPDDR5/5X JESD原版协议
- er图习题大全.docx
- 基于多个TCP连接的TCPserver转串口 可以实现通过注册包区分多个TCP连接,实现特定TCP连接和串口之间的数据转发
- 手机、钱包、笔记本检测34-YOLO(v5至v11)、COCO、CreateML、Paligemma、VOC数据集合集.rar
- 磁盘调度算法的Python实现及优化策略
- 已知A点到任意多边形距离最小,求该多边形最小距离点的坐标
- MyBatis中文帮助文档
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0