package TestFirst;
import java.util.Arrays;
import java.util.Objects;
import java.util.Scanner;
public class TestBank {
public static void main(String[] args) {
Bank bank=new Bank();
bank.login();
}
}
class Bank{
Scanner input=new Scanner(System.in);
User [] users=new User[3];
public void initial(){
User u1=new User("123456789","123456","12345678910","150222166605620214",
2000.0);
users[0]=u1;
User u2=new User("987654321","123456","12345678910","150222166605620214",
2000.0);
users[1]=u2;
User u3=new User("12312312","123456","12345678910","150222166605620214",
2000.0);
users[2]=u3;
}
public void login() {
initial();
System.out.println("欢迎登陆白纸ATM自助终端");
System.out.println("请根据提示信息登录");
System.out.println("请输入您的卡号");
String account = input.next();
System.out.println("请输入您的密码");
String pwd = input.next();
//判断卡号和密码是否正确
for (User user : users) {
if (user.getAccount().equals(account) && user.getPassword().equals(pwd)) {
System.out.println("登陆成功");
showMenu();
return;
} else {
System.out.println("请重新输入");
login();
}
}
}
public void showMenu(){
int choice;
do {
System.out.println("欢迎使用xxx自主端操作界面");
System.out.println("1.查询余额 2.修改密码 3. 存款 4.取款 5.转账 6.退出");
System.out.println("输入操作编号");
choice=input.nextInt();
switch (choice){
case 1:
System.out.println("查询余额");
queryBalance();
break;
case 2:
System.out.println("修改密码");
updatePassword();
break;
case 3:
System.out.println("存款");
save();
break;
case 4:
System.out.println("取款");
take();
break;
case 5:
System.out.println("修改密码");
updatePassword();
break;
case 6:
break;
default:
System.out.println("密码输入错误,请重更新输入");
break;
}
}while (choice!=6);
}
//查询余额
public void queryBalance(){
}
//修改密码
public void updatePassword(){
}
//存款
public void save(){
}
//取款
public void take(){
}
//转账
public void transfer(){
}
}
class User{
//账户
private String account;
//密码
private String password;
//电话
private String phone;
//身份证号
private String identityCard;
//余额
private double balance;
public User(String account, String password, String phone, String identityCard, double balance) {
this.account = account;
this.password = password;
this.phone = phone;
this.identityCard = identityCard;
this.balance = balance;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getIdentityCard() {
return identityCard;
}
public void setIdentityCard(String identityCard) {
this.identityCard = identityCard;
}
public double getBalance() {
return balance;
}
public void setBalance(double balance) {
this.balance = balance;
}
}
标签:java,String,管理系统,void,练习,System,println,public,out
From: https://blog.csdn.net/SYK09/article/details/143799297