账户类
public class Account {
private String name;
private String word;
private int money;
private String id;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getWord() {
return word;
}
public void setWord(String word) {
this.word = word;
}
public int getMoney() {
return money;
}
public void setMoney(int money) {
this.money = money;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Account() {
}
public Account(String name, String word, int money, String id) {
this.name = name;
this.word = word;
this.money = money;
this.id = id;
}
}
实例程序
public class ATM {
public static void main(String[] args) {
ATM atm = new ATM();
atm.run(atm.acc);
}
Account[] account = {
new Account("card1", "mima1", 1000,"001"),
new Account("card2", "mima2", 2000,"002"),
new Account("card3", "mima3", 3000,"003")
};
private Account acc;
Scanner scanner = new Scanner(System.in);
public void run(Account account) {
this.login();
if (acc != null)