77范文网 - 专业文章范例文档资料分享平台

张迪的课程设计报告(4)

来源:网络收集 时间:2020-03-26 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

if (this.getBalance() >= money) {

this.setBalance(this.getBalance() - money); return this; } else {

if (this.getBalance() + this.getCeiling() >= money) {

System.out.println(\本次已透支\ this.setCeiling(this.getCeiling() + this.getBalance() - money); System.out.println(\可透支\ this.setBalance(0); return this; } else {

System.out.println(\余额不足,超过透支额度\ return null; } } }

@Override

public String toString() {

Double d = new Double(getBalance()); Double c = new Double(getCeiling());

return getId() + \ + string(getPersonId()) + string(getEmail())

+ string(d.toString()) + string(c.toString()) + string(\ + \ } }

4.1.3 储蓄账户模型 package ATM_Bank;

//储蓄账户

public class SavingAccount extends Account { public SavingAccount() {

}

public SavingAccount(Long id, String password, String name, String personId, String email, double balance) { // TODO 自动生成的构造函数存根 this.setId(id);

this.setPassword(password); this.setName(name);

this.setPersonId(personId); this.setEmail(email);

this.setBalance(balance); }

// 取款

protected Account withdraw(double money) { if (this.getBalance() >= money) {

this.setBalance(this.getBalance() - money); return this; } else {

System.out.println(\余额不足\ return null; } }

@Override

public String toString() {

Double d = new Double(getBalance());

return getId() + \ + string(getPersonId()) + string(getEmail())

+ string(d.toString()) + string(\ + \ } }

4.1.4 可以贷款可以透支账户模型 package ATM_Bank;

//可以贷款可以透支账户

public class LoanCreditAccount extends CreditAccount implements Loanable {

@Override

public Account requestLoan(double money) { // TODO 自动生成的方法存根 return null; }

@Override

public Account payLoan(double money) { // TODO 自动生成的方法存根 return null; }

public LoanCreditAccount(Long id, String password, String name,

String personId, String email, double balance, double ceiling, Long loanAmount) {

this.setId(id);

this.setPassword(password); this.setName(name);

this.setPersonId(personId); this.setEmail(email); this.setBalance(balance); this.setCeiling(ceiling);

this.setLoanAmount(loanAmount); }

@Override

public String toString() {

Double d = new Double(getBalance()); Double c = new Double(getCeiling());

return getId() + \ + string(getPersonId()) + string(getEmail()) + string(d.toString()) + string(c.toString())

+ string(getLoanAmount().toString()) + \ } }

4.1.5 可以贷款不可以透支账户模型 package ATM_Bank;

//可以贷款不可以透支账户

public class LoanSavingAccount extends SavingAccount implements Loanable {

@Override

public Account requestLoan(double money) { // TODO 自动生成的方法存根 return null; }

@Override

public Account payLoan(double money) { // TODO 自动生成的方法存根 return null; }

public LoanSavingAccount(Long id, String password, String name,

String personId, String email, double balance, Long loanAmount) { this.setId(id);

this.setPassword(password); this.setName(name);

this.setPersonId(personId);

}

this.setEmail(email); this.setBalance(balance);

this.setLoanAmount(loanAmount); }

@Override

public String toString() {

Double d = new Double(getBalance());

return getId() + \ + string(getPersonId()) + string(getEmail()) + string(d.toString()) + string(\

+ string(getLoanAmount().toString()) + \}

4.2 Bank类

package ATM_Bank; import java.io.File;

import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.text.DateFormat;

import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Scanner;

public class Bank {

private ArrayList setAcc = new ArrayList(); // 当前所有的账户对象的信息

private int index = 0; // 当前账户数量

public int getIndex() { return index; }

public void setIndex(int index) { this.index = index; }

// 创建文件

public File creatFile() {

File file = new File(\

file = new File(\ try {

file.createNewFile(); } catch (IOException e) {

// TODO 自动生成的 catch 块 e.printStackTrace(); }

return file; }

// 写文件

public void writeFile(File file, String str) { OutputStream outputStream = null; try {

outputStream = new FileOutputStream(file); str = str.replace(\ str = str.replace(\

str = \账户号码 账户密码 身份证号码 客户的电子邮箱 账户余额 贷款金额 用户类型\\r\\n \

+ str.replace(\ byte[] b = str.getBytes(); outputStream.write(b);

} catch (FileNotFoundException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); } catch (IOException e) {

// TODO 自动生成的 catch 块 e.printStackTrace(); } finally { try {

outputStream.close(); } catch (IOException e) {

// TODO 自动生成的 catch 块 e.printStackTrace(); } } }

private Long getID() {

DateFormat ny = new SimpleDateFormat(\ String str = \

str += ny.format(new Date()) + \ Long Id = new Long(str);

真实姓名透支额度

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库张迪的课程设计报告(4)在线全文阅读。

张迪的课程设计报告(4).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/jiaoyu/875185.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: