import java.util.Scanner;
public class Xpq {
public static void main(String[] args){
Scanner cs=new Scanner(System.in);
int i=1;
double yue = 5000;
do{
System.out.println("请输入账号:");
String user = cs.next();
System.out.println("请输入密码:");
String password = cs.next();
if (user != null && password != null) {
System.out.println("登录成功!");
System.out.println("欢迎用户:" + user + "");
System.out.println("您的余额为:" + yue);
System.out.println("存款请输入 :1 取款请输入:2");
String yier = cs.next();
if (Integer.parseInt(yier) == 1) {
System.out.println("请输入存款金额:");
String cunkuang = cs.next();
if (Integer.parseInt(cunkuang) > 0) {
System.out.println("存款成功,您的余额为:" + (yue=yue + Integer.parseInt(cunkuang)));
System.out.println("继续查询:1 结束查询:2");
String panduan=cs.next();
i=Integer.parseInt(panduan);
System.out.println();
} else {
System.out.println("存款失败,存款金额输入错误");
System.out.println("继续查询:1 结束查询:2");
String panduan=cs.next();
i=Integer.parseInt(panduan);
}
} else if (Integer.parseInt(yier) == 2) {
System.out.println("请输入取款金额:");
String qukuang = cs.next();
if (Integer.parseInt(qukuang) <= yue) {
System.out.println("取款成功,您的余额为:" + (yue=yue - Integer.parseInt(qukuang)));
System.out.println("继续查询:1 结束查询:2");
String panduan=cs.next();
i=Integer.parseInt(panduan);
} else {
System.out.println("存款失败,取款金额输入错误");
System.out.println("继续查询:1 结束查询:2");
String panduan=cs.next();
i=Integer.parseInt(panduan);
}
}else{
System.out.println("输入错误");
System.out.println("继续查询:1 结束查询:2");
String panduan=cs.next();
i=Integer.parseInt(panduan);
}
}
}while(i==1);
}
}
所以想问什么呢?
– winds_随风 4年前