import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Vector;
import java.io.*;
public class Bank {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
/*
* 父类别
* */
class Account {
int balance; //含有款项
String record;
Vector vTransAct = new Vector(); //交易资料
void listInfo(){ //查询
System.out.println("此帐户目前额度为[" + balance + "]元");
}// end of listInfo()
void depositMoney(int value) { // 存款
balance += value;
System.out.println("已存入[" + value + "]元");
record = sdf.format(new Date()) + " 存入[" + value + "]元";
vTransAct.add(record);
listInfo();
}// end of depositMoney()
void getMoney(int value){
balance += value;
}
}
/*
* 客户帐户子类别
* */
class Client_Acc extends Account{
String record, accName;
Client_Acc(String name){
balance = 5000;
accName = name;
}//end of Constructor
void transferMoney(int value, Client_Acc target){ // 转帐
balance -= (value + 30);
target.getMoney(value);
System.out.println("已将[" + "]元转入" + target.accountOwner() + "之帐户");
record = sdf.format(new Date()) + " 转帐[" + value + "]元 对象[" + target.accountOwner() + "]之帐户";
vTransAct.add(record);
record = sdf.format(new Date()) + " 接收[" + value + "]元 来自[" + accName + "]之帐户";
target.vTransAct.add(record);
listInfo();
}// end of transferMoney()
void withdrawMoney(int value){ // 提款
balance -= value;
System.out.println("已提出[" + value + "]元");
record = sdf.format(new Date()) + " 提款[" + value + "]元";
vTransAct.add(record);
listInfo();
}// end of withdrawMoney()
String accountOwner(){
return accName;
}
}
/*
* 行员帐户子类别
* */
class Manager_Acc extends Account{
String record;
void listHistory(Client_Acc ..
访客只能看到部份内容,免费 加入会员 或由脸书 Google 可以看到全部内容