该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

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作界面_银行运行模拟编程 求助!!!相关推荐

  1. java登录页-视图界面_地图界面-Java集合

    java登录页-视图界面 A Map stores data in key and value association. Both key and values are objects. The ke ...

  2. java实现仿qq界面及功能、网路编程、实现抽象工厂模式、线程池代码与测试

    java实现仿qq界面及功能 用Swing 代码在百度网盘:http://pan.baidu.com/s/1pJjxI4b 具体见https://www.iteye.com/topic/1137293 ...

  3. java转成图形界面_【转】java图形界面设计(AWT)

    [转自]http://blog.sina.com.cn/s/blog_616e189f0100ne1t.html 1.       基本的java Frame操作. Java的图形界面的类主要包括AW ...

  4. Java 启动和停止界面_一文详解各种花里胡哨的Java调试技巧,多图预警,记得收藏...

    欢迎关注专栏<Java架构筑基>--专注于Java技术的研究与分享! Java架构筑基​zhuanlan.zhihu.com Java架构筑基--专注于Java技术的研究与分享! 后续文章 ...

  5. Java 启动和停止界面_我的世界Java版1.16.4-pre2游戏下载-我的世界Java版1.16.4-pre2中文版下载...

    我的世界Java版是一款可以让玩家自由发挥自己创造力的像素沙盒类游戏,在这款游戏中玩家就是一片天地的造物主,玩家可以把现实中一切的建筑都完美的复刻在这款游戏里,如此好玩的游戏,玩家还在等什么,快来下载 ...

  6. java 百度账号注册界面_基于百度AI使用H5实现调用摄像头进行人脸注册、人脸搜索功能(Java)...

    人脸注册.人脸搜索使用百度AI接口.不支持H5活体检测(需要活体检测请参考百度AI-H5活体检测) 只是为了演示.所以是IP.最好用火狐浏览器访问.谷歌提示异常作者就不专门修改了.大家可以直接下载源码 ...

  7. java jar包存放位置_获得运行jar包存放路径的方法

    在 java 中, System.getProperty("user.dir") 得到的是当前工作路径(对应命令行命令就是 linux 下的 pwd . windows 下的 cd ...

  8. 游戏中java未安装不了_游戏运行库和常见游戏安装问题的解决方法

    游戏运行库是玩游戏必不可少的东西,相信玩家们都遇到因为没装某某运行库而导致游戏无法安装或者玩不了的问题,今天小编就为大家列出了一些常见的运行库以及游戏安装和运行时的一些问题的解决方法. 首先小编要为大 ...

  9. java实现续打功能_银行存折套打续打功能--报表如何记录上次打印的位置

    在实际项目中,经常会遇到打印的需求,而对于打印的特殊需求也越来越多,例如需要记录上次打印位置,当前打印时根据上次的打印位置继续打印的功能,像银行的存折的数据每次打印都不是用新的纸张,而是根据上次打印的 ...

最新文章

  1. python能编写手机软件-怎么用Python编写一个手机聊天软件或程序
  2. 网管必备的十大网络安全测试工具
  3. python 通过 实例方法 名字的字符串调用方法
  4. C语言之strstr函数类似Java字符串的contain函数
  5. 产品经理经验谈100篇(二)-数据分析应用,如何构建指标体系?
  6. LeetCode 第 206 场周赛(733/4491,前16.3%)
  7. PHP store session with couchbase
  8. webConfig详细跳转配置.[转]
  9. Java学习之——泛型
  10. 为什么沃伦·巴菲特有那么多的时间去阅读和思考
  11. 使用Fiddler进行http抓包和调试
  12. python将png转换为ico
  13. 复制出来的虚拟机加入域提示试图加入域的SID与本计算机的SID相同解决方法
  14. 基于wincap写抓包程序
  15. python有道字典翻译_使用Python从有道词典网页获取单词翻译
  16. Excel2007无法卸载:安装程序包的语言不受系统支持。微软的卸载程序也不行。——只能手工删除
  17. TankWar 单机(JAVA版)版本2.3~版本2.4 为坦克画血条
  18. 数据库基础内容(超级详细)
  19. 队列的顺序实现(入队、出队、对长、获取队头元素)
  20. 阿朱说 企业SaaS 无题

热门文章

  1. mysql整段注释_MySQL 添加注释(comment)
  2. benchmark如何测试mysql数据库_MySQL的benchmark函数
  3. 十分钟弄懂最快的APP自动化工具uiautomator2
  4. matlab虚拟现实之V-Realm Builder2中viewpoint节点的使用
  5. Java 压缩解压缩 第三方组件,推荐一个强大的Java开发工具类库!
  6. 关于xcode下访问mysql出现中文乱码的问题
  7. AT0 Intrudoction
  8. sd卡座封装尺寸_讯普电子SD卡座的引脚定义
  9. python路径中有中文_python3 网址路径中带中文的处理办法
  10. python计算数组元素个数_python简单获取数组元素个数的方法