package bankentry;
import java.util.Scanner;
public class Bankentry {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String choose;//说明变量保存用户选择
System.out.println("welcome use bank atm");
Scanner sc1 = new Scanner(System.in);
String name = "admin";
String password ="admin123";
int sum = 1000;
long draw;//取款声明
long deposit;//存款变量
System.out.println("输入用户名");
String name1 =sc1. next();
System.out.println("密码");
String password1 =sc1. next();
if(name.equals(name1)&&password.equals(password1)){
System.out.println("welcome 使用本ATM服务");
System.out.println("(1)查询余额");
System.out.println("(2)取款和转账");
System.out.println("(3)存款");
System.out.println("(4)退出");
System.out.println("请选择");
do {
choose = sc1.next();//接收输入
switch (choose){
case "1":
System.out.println("查询余额");
System.out.println("老大你的银行卡余额为"+sum);
break;
case "2":
System.out.println("取款和转账");
System.out.println("输入取款or转账金额:");
draw = sc.nextInt();
if(draw<=sum&&draw%100==0){
System.out.println("余额为"+(sum-=draw));
}break;
case "3":
System.out.println("存款");
System.out.println("输入存款金额:");
deposit = sc.nextInt();
if(deposit<=sum&&deposit%100==0){//存款条件
System.out.println("存款成功,现在老大你的余额为"+(sum+=deposit));
}break;
case "4":
System.out.println("退出");
System.out.println("欢迎您再次使用");
break;
default:
System.out.println("输入错误");
break;
}
}while(!"4".equals(choose ));
}
}
}