进阶のJAVA8

Java 的学习,必须是在无聊的敲代码中度过的。不能忍着无聊,沉淀下来,学不到东西。其实学习一门计算机语言,和学习数学差不多,需要无聊的酝酿期。
完成一个个小的功能,看着她的实现,等着他成为一个独当一面的程序,这是一件令人兴奋的事情。
初次结识面向对象,她是一个迷人的姑娘,看不懂他的面目,神秘感性。
当你认识之后觉得他和其他姑娘一样。平淡无奇。面向对象其实就是一个对象,在我看他只不过是指代这个那个东西的一个代名词.

 

//使用方法:

import java.util.Scanner;

public class Test6 {

/* 修改ATM 实现静态方法调用*/
static boolean flag=true;
public static int betId() {//输入账号
int id1 = 0;
Scanner test = new Scanner(System.in);
System.out.println("请输入账号:");

id1 = test.nextInt();
return id1;
}

public static int betPassword() {//输入密码
int password1 = 0;
Scanner test = new Scanner(System.in);
System.out.println("请输入密码:");
password1 = test.nextInt();
return password1;
}

public static void choose() {//界面选项
Scanner test = new Scanner(System.in);
int a = 0, b = 0, c = 0;
while (true) {

System.out.println("1-存款 2-取款 3-查询 4-退出");
System.out.println("请输入选项:");
int number = test.nextInt();
switch (number) {
case 1:
System.out.println("请输入金额:");
a = a + test.nextInt();
continue;
case 2:
System.out.println("请输出金额");
b = test.nextInt();
a = a - b;
continue;
case 3:
System.out.println("余额" + a);
continue;
case 4:
flag=false;
break;
default:
System.out.println("输入有误请重新输入:");
continue;
}
return;
}

}

public static void circulation() {//账号密码判断
int i = 0;
int Id = 123;
int password = 123;


while (i < 3) {
if(flag==false){

break;
}

int id = betId();
int password1 = betPassword(); 
if (password1 == password && id == Id) {
choose();
} else {
System.out.println("请重新输入");
i++;
}

}
if(flag==true){
System.out.println("你的密码输入错误三次以上,账号已锁定,请到营业厅修改密码");
}
}

public static void main(String[] args) {
// TODO Auto-generated method stub
circulation();

}


}

转载于:https://www.cnblogs.com/xiaolonging/p/3652698.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值