JAVA给banking作界面_银行运行模拟编程 求助!!!
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
public CheckingAccount(double bal, double protect)
public CheckingAccount(double bal) //bal:初时账户余额,protect:透支额度
d)类CheckingAccount必须覆盖父类withdraw 方法。实现以下功能:如果余额足够取,按正常方式取钱,否则将判断透支是否超过额度,超过不能取,没超过可以正常取钱。并返回boolean型变量。
3)SavingsAccount类(储蓄卡帐户)
a)SavingsAccount类为Account的子类
b)属性interestRate为利率
c)含有两个参数的构造器,注意必需要调用父类的一个参数的构造器。
public SavingsAccount(double bal, double rate) //bal:账户余额//rate 利率
4)Customer类
a)声明四个属性: firstName, lastName,numberOfAccounts and accounts数组
b)声明2个参数的构造器 (f and l) 给属性赋初值
c)declare two public accessors for the object attributes; these methods getFirstName and getLastName simply return the appropriate attribute
d)声明setAccount方法赋帐号
e)其余参考UML图
5) Bank类
参考UML图
6)TestBanking类[1],该类为未完成类,在step1和step2位置按要求补充完整。
//TestBanking.java
/*
* This class creates the program to test the banking classes.
* It creates a set of customers, with a few accounts each,
* and generates a report of current account balances.
*/
import banking.*;
import java.text.NumberFormat;
public class TestBanking {
public static void main(String[] args) {
NumberFormat currency_format = NumberFormat.getCurrencyInstance();
Bank bank = new Bank();
Customer customer;
// Create several customers and their accounts
bank.addCustomer("Jane", "Simms");
customer = bank.getCustomer(0);
customer.addAccount(new SavingsAccount(500.00, 0.05));
customer.addAccount(new CheckingAccount(200.00, 400.00));
bank.addCustomer("Owen", "Bryant");
customer = bank.getCustomer(1);
customer.addAccount(new CheckingAccount(200.00));
bank.addCustomer("Tim", "Soley");
customer = bank.getCustomer(2);
customer.addAccount(new SavingsAccount(1500.00, 0.05));
customer.addAccount(new CheckingAccount(200.00));
bank.addCustomer("Maria", "Soley");
customer = bank.getCustomer(3);
// Maria 和 Tim 共有一个信用卡帐号
customer.addAccount(bank.getCustomer(2).getAccount(1));
customer.addAccount(new SavingsAccount(150.00, 0.05));
// 生成报表
System.out.println("\t\t\tCUSTOMERS REPORT");
System.out.println("\t\t\t================");
for ( int cust_idx = 0; cust_idx < bank.getNumOfCustomers(); cust_idx++ ) {
customer = bank.getCustomer(cust_idx);
System.out.println();
System.out.println("Customer: "
+ customer.getLastName() + ", "
+ customer.getFirstName());
for ( int acct_idx = 0; acct_idx < customer.getNumOfAccounts(); acct_idx++ ) {
Account account = customer.getAccount(acct_idx);
String account_type = "";
//测试帐号类型
/*** Step 1:
**** 使用instanceof 测试帐号类型
**** 设置变量 account_type 到合适的值,如
**** "Savings Account" 或 "Checking Account".
***/
// 打出当前帐号余额
/*** Step 2:
**** 打出帐号类型和余额
****参考变量currency_format 的类型,找到API文档,格式化输出数据
**** 生成帐号字符串.
***/
}
}
}
}
[1] 登陆邮箱:jspshixun@163.com领取电子档
JAVA给banking作界面_银行运行模拟编程 求助!!!相关推荐
- java登录页-视图界面_地图界面-Java集合
java登录页-视图界面 A Map stores data in key and value association. Both key and values are objects. The ke ...
- java实现仿qq界面及功能、网路编程、实现抽象工厂模式、线程池代码与测试
java实现仿qq界面及功能 用Swing 代码在百度网盘:http://pan.baidu.com/s/1pJjxI4b 具体见https://www.iteye.com/topic/1137293 ...
- java转成图形界面_【转】java图形界面设计(AWT)
[转自]http://blog.sina.com.cn/s/blog_616e189f0100ne1t.html 1. 基本的java Frame操作. Java的图形界面的类主要包括AW ...
- Java 启动和停止界面_一文详解各种花里胡哨的Java调试技巧,多图预警,记得收藏...
欢迎关注专栏<Java架构筑基>--专注于Java技术的研究与分享! Java架构筑基zhuanlan.zhihu.com Java架构筑基--专注于Java技术的研究与分享! 后续文章 ...
- Java 启动和停止界面_我的世界Java版1.16.4-pre2游戏下载-我的世界Java版1.16.4-pre2中文版下载...
我的世界Java版是一款可以让玩家自由发挥自己创造力的像素沙盒类游戏,在这款游戏中玩家就是一片天地的造物主,玩家可以把现实中一切的建筑都完美的复刻在这款游戏里,如此好玩的游戏,玩家还在等什么,快来下载 ...
- java 百度账号注册界面_基于百度AI使用H5实现调用摄像头进行人脸注册、人脸搜索功能(Java)...
人脸注册.人脸搜索使用百度AI接口.不支持H5活体检测(需要活体检测请参考百度AI-H5活体检测) 只是为了演示.所以是IP.最好用火狐浏览器访问.谷歌提示异常作者就不专门修改了.大家可以直接下载源码 ...
- java jar包存放位置_获得运行jar包存放路径的方法
在 java 中, System.getProperty("user.dir") 得到的是当前工作路径(对应命令行命令就是 linux 下的 pwd . windows 下的 cd ...
- 游戏中java未安装不了_游戏运行库和常见游戏安装问题的解决方法
游戏运行库是玩游戏必不可少的东西,相信玩家们都遇到因为没装某某运行库而导致游戏无法安装或者玩不了的问题,今天小编就为大家列出了一些常见的运行库以及游戏安装和运行时的一些问题的解决方法. 首先小编要为大 ...
- java实现续打功能_银行存折套打续打功能--报表如何记录上次打印的位置
在实际项目中,经常会遇到打印的需求,而对于打印的特殊需求也越来越多,例如需要记录上次打印位置,当前打印时根据上次的打印位置继续打印的功能,像银行的存折的数据每次打印都不是用新的纸张,而是根据上次打印的 ...
最新文章
- python能编写手机软件-怎么用Python编写一个手机聊天软件或程序
- 网管必备的十大网络安全测试工具
- python 通过 实例方法 名字的字符串调用方法
- C语言之strstr函数类似Java字符串的contain函数
- 产品经理经验谈100篇(二)-数据分析应用,如何构建指标体系?
- LeetCode 第 206 场周赛(733/4491,前16.3%)
- PHP store session with couchbase
- webConfig详细跳转配置.[转]
- Java学习之——泛型
- 为什么沃伦·巴菲特有那么多的时间去阅读和思考
- 使用Fiddler进行http抓包和调试
- python将png转换为ico
- 复制出来的虚拟机加入域提示试图加入域的SID与本计算机的SID相同解决方法
- 基于wincap写抓包程序
- python有道字典翻译_使用Python从有道词典网页获取单词翻译
- Excel2007无法卸载:安装程序包的语言不受系统支持。微软的卸载程序也不行。——只能手工删除
- TankWar 单机(JAVA版)版本2.3~版本2.4 为坦克画血条
- 数据库基础内容(超级详细)
- 队列的顺序实现(入队、出队、对长、获取队头元素)
- 阿朱说 企业SaaS 无题
热门文章
- mysql整段注释_MySQL 添加注释(comment)
- benchmark如何测试mysql数据库_MySQL的benchmark函数
- 十分钟弄懂最快的APP自动化工具uiautomator2
- matlab虚拟现实之V-Realm Builder2中viewpoint节点的使用
- Java 压缩解压缩 第三方组件,推荐一个强大的Java开发工具类库!
- 关于xcode下访问mysql出现中文乱码的问题
- AT0 Intrudoction
- sd卡座封装尺寸_讯普电子SD卡座的引脚定义
- python路径中有中文_python3 网址路径中带中文的处理办法
- python计算数组元素个数_python简单获取数组元素个数的方法