*/
public class Atm {
public static void main(String[] args) {
// TODO Auto-generated method stub
Operation o = new Operation();
o.welcome();
o.login();
o.serviceAll();
}
}
package testATM;
public class Services {
private int t=0;//t记录密码输入错误次数及选择服务项目时的输入错误次数
private String password;
private int balance;
private int depositAll;
private int drawAll;
public Services(){
password="123456";
balance=20000;
depositAll=0;
drawAll=0;
}
public int getT() {
return t;
}
public void setT(int t) {
this.t = t;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
public int getDepositAll() {
return depositAll;
}
public void setDepositAll(int depositAll) {
this.depositAll = depositAll;
}
public int getDrawAll() {
return drawAll;
}
public void setDrawAll(int drawAll) {
this.drawAll = drawAll;
}
}
package testATM;
import java.util.Scanner;
public class Operation {
private int f = 0;
Services ser;
public Operation(){
ser = new Services();
}
Scanner scan = new Scanner(System.in);
public void login() {
//进入系统
System.out.println("1、进入系统\t2、退出");
int i1 = scan.nextInt();
boolean flag = true;
while (flag) {
switch (i1) {
case 1:
// welcome();
flag = false;
break;
case 2:
rewelcome();
System.exit(0);
default:
System.out.println("请重新输入:");
i1 = scan.nextInt();
}
}
//输入密码及其验证
System.out.println("请输入密码:");
String pw = scan.next();
while (ser.getT() < 2) {
if (ser.getPassword().equals(pw))
package testATM;/** code by Xu Xingrui*/public class Atm { public static void main(String[] args) { // TODO Auto-generated method stub Operation o = new Operation(); o.welcome(); o.login