package arraylist;
創(chuàng)新互聯(lián)公司,為您提供重慶網(wǎng)站建設(shè)公司、網(wǎng)站制作、網(wǎng)站營(yíng)銷推廣、網(wǎng)站開發(fā)設(shè)計(jì),對(duì)服務(wù)成都邊坡防護(hù)網(wǎng)等多個(gè)行業(yè)擁有豐富的網(wǎng)站建設(shè)及推廣經(jīng)驗(yàn)。創(chuàng)新互聯(lián)公司網(wǎng)站建設(shè)公司成立于2013年,提供專業(yè)網(wǎng)站制作報(bào)價(jià)服務(wù),我們深知市場(chǎng)的競(jìng)爭(zhēng)激烈,認(rèn)真對(duì)待每位客戶,為客戶提供賞心悅目的作品。 與客戶共同發(fā)展進(jìn)步,是我們永遠(yuǎn)的責(zé)任!
import java.util.Scanner;
public class AtmDemo
{
public static void main(String[] args)
{
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
Boolean flag = true;
int times = 0;
while(flag){
times++;
if(times == 4){
System.out.println("密碼錯(cuò)誤,請(qǐng)取卡");
break;
}
System.out.println("請(qǐng)輸入你的密碼");
String password = sc.next();
if(password.equals("111111")){
Boolean moneyflag = true;
while(moneyflag){
System.out.println("請(qǐng)輸入金額");
int number = sc.nextInt();
if(number = 0 number = 1000 number % 100 == 0){
System.out.println("用戶取了" + number + "元。交易完成");
moneyflag = false;
}else{
System.out.println("請(qǐng)重新輸入金額");
}
}
break;
}else{
continue;
}
}
}
}
下面是一個(gè)簡(jiǎn)單的登錄示例:
代碼復(fù)制展示:
public class ATMLogin {
public static void main(String[] args) {
// 設(shè)置用戶名和密碼
String username = "gqk";
String password = "520";
// 最多可以登錄 3 次
for (int i = 0; i 3; i++) {
// 讀取用戶輸入的用戶名和密碼
Scanner in = new Scanner(System.in);
System.out.print("請(qǐng)輸入用戶名:");
String inputUsername = in.nextLine();
System.out.print("請(qǐng)輸入密碼:");
String inputPassword = in.nextLine();
// 檢查用戶名和密碼是否正確
if (inputUsername.equals(username) inputPassword.equals(password)) {
System.out.println("歡迎" + username + "登錄!");
break; // 登錄成功,退出循環(huán)
} else {
System.out.println("用戶名或密碼錯(cuò)誤,請(qǐng)重新輸入!");
}
}
// 如果 3 次登錄都失敗,則提示用戶
System.out.println("卡片已經(jīng)被鎖,請(qǐng)聯(lián)系客服人員!");
}
}
回答不易望請(qǐng)采納
/** * @author admin * 該程序的功能為實(shí)現(xiàn)模擬銀行ATM自動(dòng)取款機(jī)提款,查詢等功能. */ import Java.io.*; /*該類為實(shí)現(xiàn)客戶信息及部分功能*/ class Account { private String code =null; //信用卡號(hào) private String name =null; //客戶姓名 private String password=null; //客戶密碼 private double money =0.0; //卡里金額 public Account(String code,String name,String password,double money) { this.code=code; this.name=name; this.password=password; this.money=money; } protected String get_Code() { return code; } protected String get_Name() { return name; } protected String get_Password() { return password; } public double get_Money() { return money; } /*得到剩余的錢的數(shù)目*/ protected void set_Balance(double mon) { money -= mon; } } /**********實(shí)現(xiàn)具體取款機(jī)功能*********/ class ATM { Account act; // private String name; // private String pwd; public ATM() { act=new Account("000000","Devil","123456",50000); } /***********歡迎界面***********/ protected void Welcome() { String str="---------------------------------"; System.out.print(str "\n" "歡迎使用Angel模擬自動(dòng)取款機(jī)程序.\n" str "\n"); System.out.print(" 1.取款." "\n" " 2.查詢信息." "\n" " 3.密碼設(shè)置." "\n" " 4.退出系統(tǒng)." "\n"); } /**********登陸系統(tǒng)**********/ protected void Load_Sys() throws Exception { String card,pwd; int counter=0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); do { System.out.println("請(qǐng)輸入您的信用卡號(hào):"); card=br.readLine(); System.out.println("請(qǐng)輸入您的密碼:"); pwd=br.readLine(); if(!isRight(card,pwd)) { System.out.println("您的卡號(hào)或密碼輸入有誤."); counter ; } else SysOpter(); }while(counter3); Lock_Sys(); } 回復(fù)獲取全部
網(wǎng)頁(yè)標(biāo)題:java程序atm代碼 java atm取款機(jī)程序
網(wǎng)頁(yè)網(wǎng)址:http://m.newbst.com/article24/dogppce.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站制作、網(wǎng)站建設(shè)、建站公司、Google、網(wǎng)站改版、搜索引擎優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)