package analog_ATM;
import java.io.IOException;
//import java.sql.*;
import java.util.*;
/**
* 1.账户类,模拟ATM机,即读取了用户的个人信息
* 2.查询余额
* 3.交易记录
* 4.存/取
* 5.其他功能
*/
class InsufficientFundsException extends Exception{//自定义异常类
Account account; //貌似有危险
private double dAmount;
InsufficientFundsException(){} //无参
InsufficientFundsException(Account account, double dAmount){
this.account = account;
this.dAmount = dAmount;
}
public String getMessage(){ //错误信息
String str = "取款失败!账户余额:" + account.getBalance()+ ",取款额:" + dAmount + ",余额不足";
return str;
}
}
class Account{
boolean isUseful = true; //卡是否可用
String cardNumber; //4位数的卡号,由银行按照规定分配
String userName; //用户名
String password; //密码
double balance; //余额
Account(){
this.isUseful = true;
this.balance = 0.0;
}
Account(String cardNumber, String userName, String password){
this.isUseful = true;
this.balance = 0.0;
this.cardNumber = cardNumber;
this.userName = userName;
this.password = password;
}
//
//public void setCardNumber() {
//Random