java问题,想知道这个小程序 没有任何报错,在eclipse中 运行一篇空白?其他程序在eclipse中能正常运行?
importjava.util.Scanner;/****模拟atm取款流程*/publicclassAtm1{publicstaticvoidmain(String[]...
import java.util.Scanner;
/**
*
*模拟atm取款流程
*/
public class Atm1 {
public static void main(String[] args) {
int password;//取款密码
int amount ;//取款金额
boolean mimazhengque = false;//判断输入密码是否正确
Scanner input = new Scanner(System.in);//从键盘输入
for (int i = 1; i <= 3; i++){
password = input.nextInt();//获取从键盘输入的密码
System.out.print("请输入密码:");
if (password == 111111){
mimazhengque = true;//判断密码是否正确
break;
}
}for (int a = 1; a <= 3;a++){
if (mimazhengque){
while (true){
amount = input.nextInt();//获取从键盘输入的金额
System.out.print("请输入金额:");
if (amount >= 0 && amount <= 1000 && amount % 100 ==0 ){
System.out.println("您取了" + "元\n交易完成,请取卡!");
}
}
} else {
amount = input.nextInt();//重新获取输入金额
System.out.print("您输入的金额不合法,请重新输入:");
} System.out.println("密码错误,请取卡!");
}
}
} 展开
/**
*
*模拟atm取款流程
*/
public class Atm1 {
public static void main(String[] args) {
int password;//取款密码
int amount ;//取款金额
boolean mimazhengque = false;//判断输入密码是否正确
Scanner input = new Scanner(System.in);//从键盘输入
for (int i = 1; i <= 3; i++){
password = input.nextInt();//获取从键盘输入的密码
System.out.print("请输入密码:");
if (password == 111111){
mimazhengque = true;//判断密码是否正确
break;
}
}for (int a = 1; a <= 3;a++){
if (mimazhengque){
while (true){
amount = input.nextInt();//获取从键盘输入的金额
System.out.print("请输入金额:");
if (amount >= 0 && amount <= 1000 && amount % 100 ==0 ){
System.out.println("您取了" + "元\n交易完成,请取卡!");
}
}
} else {
amount = input.nextInt();//重新获取输入金额
System.out.print("您输入的金额不合法,请重新输入:");
} System.out.println("密码错误,请取卡!");
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询