teller.java
来自「看图说话」· Java 代码 · 共 49 行
JAVA
49 行
package bank.v12;
/**
* 柜员机测试
*
* @author oyotong
*
*/
public class Teller {
/**
* 柜员机测试方法
*
* @param args
* @throws OpenAccountException
* @throws OverDraftException
*/
public static void main(String[] args) throws OpenAccountException {
// 开户
Account account = new CheckingAccount(1000, 5000);
System.out.println("存钱:4000");
double b = account.deposit(4000);
System.out.println("余额:" + b);
System.out.println();
System.out.println("取钱:11000");
double b2 = 0;
try {
b2 = account.withdraw(11000);
} catch (OverDraftException e) {
System.err.println(e.getMessage());
}
System.out.println("余额:" + b2);
System.out.println();
System.out.println("取钱:1000");
double b3 = 0;
try {
b3 = account.withdraw(1000);
} catch (OverDraftException e) {
System.err.println(e.getMessage());
}
System.out.println("余额:" + b3);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?