📄 transaction.java
字号:
package Bank;
//Define the Transaction 帐户上的事务处理
class Transaction {
//Transaction Types
public static final int DEBIT = 0; //借款
public static final int CREDIT = 1; //存款
public static String[] types = {"Debit","Credit"};
//Constructor 构造方法
public Transaction(Account account, int transactionType,int amount){
this.account = account;
this.transactionType = transactionType;
this.amount = amount;
}
public Account getAccount(){
return account;
}
public int getTransactionType(){
return transactionType;
}
public int getAmount(){
return amount;
}
public String toString(){
return types[transactionType] + "A//c:" + ": $" + amount;
}
private Account account; //定义账户
private int amount; //交易数额
private int transactionType; //业务类型
/*
*原理:
*事务类型有transactionType属性指定,该字段的值必须是为事务类型而定义的值之一
*acount指明了交易的帐户,而amount指明了交易的数额
*一个Transaction对象指定了一个完整的交易。
*方法只有getAmount和toString方法
*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -