import java.util.Scanner;
public class main {
static int flg1=1;
static int count = 1;
static float[][] keep = new float[2][10];
static int[] flg = new int[10];
static String no ;
static int i ;
public static void main(String[] args) {
System.out.println("===========================");
System.out.println("*******欢迎进入ATM自助系统******");
System.out.println("===========================");
Scanner scanner = new Scanner(System.in);
System.out.println("请输入你的账户号码:");
no = scanner.next();
System.out.println("请输入你的账户密码:");
String password = scanner.next();
if (no.equals("1234") && password.equals("ke")) {
System.out.println("账户密码匹配请继续");
for ( i = 0; i < 10; i++) {if (flg1==1) {
System.out.println("1.现金存款");
System.out.println("2.现金取款");
System.out.println("3.查询记录");
System.out.println("4.退出服务");
int key = scanner.nextInt();
switch (key) {
case 1:flg1=1;
flg[count] = 1;
in a = new in();
keep[0][count] = a.inin();
keep[1][count] = keep[1][count-1] + keep[0][count];
count++;
break;
case 2:flg1=1;
flg[count] = 2;
in o = new in();
keep[0][count] = o.out();
keep[1][count] = keep[1][count-1] - keep[0][count];
count++;
break;
case 3:
in list=new in();
list.listprint(flg,keep,count);flg1=1;
break;
case 4:System.out.println("成功退出"); flg1=0;
break;
default:
System.out.println("对不起无此服务");
break;
}
}if (i==10) {
System.out.println("对不起今天你的服务太过频繁现在停止今天的服务");
}
}
}
}
}
import java.util.Scanner;
public class in {
static float money;
public float inin() {
System.out.println("请输入你所要存入的金额:");
Scanner a=new Scanner(System.in);
money=a.nextFloat();
System.out.println("2010.11.25"+" 存款 "+ money );
return money ;
}
public float out() {
System.out.println("请输入你所要取的金额:");
Scanner a=new Scanner(System.in);
money=a.nextFloat();
System.out.println("2010.11.25"+" 取款 "+ money );
return money;
}
public void listprint(int[]a,float[][]b,int c){
String type;
System.out.println("时间日期 "+" 账户号码 "+" 服务类型 "+" 金 额 "+" 余 额");
for (int i = 1; i < c; i++) {
if (a[i]==1) {type="存款";
}else {
type="取款";
}
System.out.println("2010.11.25 "+" 1234 "+ type + b[0][i] + " "+ b[1][i]);
}
}
}