Java實(shí)現(xiàn)銀行賬戶管理子系統(tǒng)
本文實(shí)例為大家分享了Java實(shí)現(xiàn)銀行賬戶管理子系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
所用到的知識(shí)點(diǎn):面向?qū)ο蠡A(chǔ)語(yǔ)法,封裝,方法覆蓋(重寫)、繼承、多態(tài)
話不多說(shuō),直接上代碼
Account.java
package com.task1; import java.util.Scanner; public class Account { ?? ?//規(guī)定賬戶類型: ?? ?//0 – 儲(chǔ)蓄賬戶 ?1 – 信用賬戶 2 – 可貸款儲(chǔ)蓄賬戶 3– 可貸款信用賬戶 ?? ?private Long id ;//賬戶號(hào)碼 ?? ?private String password;//賬戶密碼 ?? ?private String name;//真實(shí)姓名 ?? ?private String personId;//身份證號(hào)碼 ?? ?private String email;//客戶的電子郵箱 ?? ?private double balance;//賬戶余額 ?? ?private int type;//賬戶類型 ?? ? ?? ?//無(wú)參的構(gòu)造方法 ?? ?public Account(){ ?? ??? ? ?? ?} ?? ? ?? ?//有參的構(gòu)造方法 ?? ?public Account(long id, String password, String name, String personId, String email, double balance, int type) { ?? ??? ??? ?super(); ?? ??? ??? ?this.id = id; ?? ??? ??? ?this.password = password; ?? ??? ??? ?this.name = name; ?? ??? ??? ?this.personId = personId; ?? ??? ??? ?this.email = email; ?? ??? ??? ?this.balance = balance; ?? ??? ??? ?this.type = type; ?? ??? ?} ?? ? ?? ?//get、set方法 ?? ?public Long getId() { ?? ??? ?return id; ?? ?} ?? ?public void setId(long id) { ?? ??? ?this.id = id; ?? ?} ?? ?public String getPassword() { ?? ??? ?return password; ?? ?} ?? ?public void setPassword(String password) { ?? ??? ?this.password = password; ?? ?} ?? ?public String getName() { ?? ??? ?return name; ?? ?} ?? ?public void setName(String name) { ?? ??? ?this.name = name; ?? ?} ?? ?public String getPersonId() { ?? ??? ?return personId; ?? ?} ?? ?public void setPersonId(String personId) { ?? ??? ?this.personId = personId; ?? ?} ?? ?public String getEmail() { ?? ??? ?return email; ?? ?} ?? ?public void setEmail(String email) { ?? ??? ?this.email = email; ?? ?} ?? ?public double getBalance() { ?? ??? ?return balance; ?? ?} ?? ?public void setBalance(double balance) { ?? ??? ?this.balance = balance; ?? ?} ?? ?public int getType() { ?? ??? ?return type; ?? ?} ?? ?public void setType(int type) { ?? ??? ?this.type = type; ?? ?} ?? ?//存款 ?? ?public Account deposit(double money ) { ?? ??? ?this.balance+= money; ? //余額增加 ?? ??? ?return this; ?? ?} ?? ? ?? ?//取款 ?? ?public Account withdraw(double money) { ?? ??? ?if(balance - money >= 0) { //判斷余額是否足夠 ?? ??? ??? ?balance -= money; ?//余額減少 //?? ??? ??? ?System.out.println("存款成功"); ?? ??? ?} ?? ??? ?else { ?? ??? ??? ?System.out.println("您的余額不足!"); ?? ??? ?} ?? ??? ?return this; ?? ?} ?? ?//重寫toString方法 ?? ?@Override ?? ?public String toString() { ?? ??? ?return "Account [id=" + id + ", password=" + password + ", name=" + name + ", personId=" + personId + ", email=" ?? ??? ??? ??? ?+ email + ", balance=" + balance + ", type=" + type + "]"; ?? ?}? ? ?? ? }
SavingAccount.java
package com.task1; public class SavingAccount extends Account { ?? ?public SavingAccount() { ?? ??? ?super(); ?? ??? ?// TODO Auto-generated constructor stub ?? ?} ?? ?public SavingAccount(long id, String password, String name, String personId, String email, double balance, ?? ??? ??? ?int type) { ?? ??? ?super(id, password, name, personId, email, balance, type); ?? ??? ?// TODO Auto-generated constructor stub ?? ?} ?? ?@Override ?? ?public String toString() { ?? ??? ?return "SavingAccount [getId()=" + getId() + ", getPassword()=" + getPassword() + ", getName()=" + getName() ?? ??? ??? ??? ?+ ", getPersonId()=" + getPersonId() + ", getEmail()=" + getEmail() + ", getBalance()=" + getBalance() ?? ??? ??? ??? ?+ ", getType()=" + getType() + "]"; ?? ?} }
CreditAccpunt.java
package com.task1; public class CreditAccount extends Account{ ?? ?private double ceiling; ?? ?public CreditAccount() { ?? ??? ?super(); ?? ?} ?? ?public CreditAccount(long id, String password, String name, String personId, String email, double balance, ?? ??? ??? ?int type,double ceiling) { ?? ??? ?super(id, password, name, personId, email, balance, type); ?? ??? ?this.ceiling = ceiling; ?? ?} ?? ?public double getCeiling() { ?? ??? ?return ceiling; ?? ?} ?? ?public void setCeiling(double ceiling) { ?? ??? ?this.ceiling = ceiling; ?? ?} ?? ?@Override ?? ?public String toString() { ?? ??? ?return "CreditAccount [getCeiling()=" + getCeiling() + ", getId()=" + getId() + ", getPassword()=" ?? ??? ??? ??? ?+ getPassword() + ", getName()=" + getName() + ", getPersonId()=" + getPersonId() + ", getEmail()=" ?? ??? ??? ??? ?+ getEmail() + ", getBalance()=" + getBalance() + ", getType()=" + getType() + "]"; ?? ?} ?? ?@Override ?? ?public Account withdraw(double money) { ?? ??? ?if(getBalance() >= money) { ?? ??? ??? ?setBalance(getBalance() - money); ?? ??? ?}else if(getBalance() + getCeiling() >= money) { ?? ??? ??? ?setCeiling(getCeiling()-(money-getBalance())); ?? ??? ??? ?setBalance(0); ?? ??? ?}else { ?? ??? ??? ?System.out.println("對(duì)不起,您的余額不足"); ?? ??? ?} ?? ??? ?return this; ?? ?}?? ?? ? }
Bank.java
package com.task1; import java.util.Scanner; public class Bank { ?? ?int index = 0; //當(dāng)前用戶數(shù)量 ?? ?Account [] accounts = new Account [100];//數(shù)據(jù)庫(kù) ?? ?Account account = null; ?? ?/* ?? ? * 用戶開(kāi)戶(register) ? ? ? 參數(shù)列表: Long 賬號(hào), String密碼, String確認(rèn)密碼,String 姓名,String身份證號(hào)碼,String郵箱,int 賬戶類型; (Long id, String password, String repassword, String name, String personID, String email, int type) ? ? ? 返回類型:Account ? ? ? 規(guī)定賬戶類型:0 – 儲(chǔ)蓄賬戶 ?1 – 信用賬戶 2 – 可貸款儲(chǔ)蓄賬戶 3– 可貸款信用賬戶 ?? ? */ ?? ?//用戶開(kāi)戶 ?? ?public Account register(Long id, String password, String repassword, String name, String personId, String email, int type) { ?? ??? ?if(password.equals(repassword)) { ?// 判斷兩次輸入密碼是否一致 ?? ??? ??? ?switch (type) { ? ? ? ? ?//根據(jù)用戶類型創(chuàng)建不同賬戶 ?? ??? ??? ?case 0:? ?? ??? ??? ??? ?account = new SavingAccount(id, repassword, name, personId, email, 0, type); ? //創(chuàng)建儲(chǔ)蓄賬戶 ?? ??? ??? ??? ? ?? ??? ??? ??? ?break; ?? ??? ??? ?case 1: ?? ??? ??? ??? ?account = new CreditAccount(id, repassword, name, personId, email, 0, type,1000); ? //創(chuàng)建信用賬戶 ?? ??? ??? ?} ?? ??? ??? ?accounts[index++] = account; ? ?//賬戶信息存到數(shù)據(jù)庫(kù),用戶數(shù)量+1 ?? ??? ?} //?? ??? ?else { //?? ??? ??? ?System.out.println("兩次輸入的密碼不一致"); //?? ??? ?} ?? ??? ?return account; ?? ?} ?? ? ?? ?//用戶登錄 ?? ?public Account login(Long id, String password) { ?? ??? ?int find = searchIdPassword(index, id, password); //當(dāng)前用戶數(shù)組下標(biāo) ?? ??? ?if(find >= 0) {?? ??? ??? ??? ??? ??? ?//判斷賬戶密碼是否正確 //?? ??? ??? ?System.out.println("登錄成功"); ?? ??? ??? ?return accounts[find]; ? ? ? ? //返回當(dāng)前對(duì)象 ?? ??? ?} //?? ??? ?else { //?? ??? ??? ?System.out.println("用戶名密碼錯(cuò)誤"); //?? ??? ?} ?? ??? ? ?? ??? ?return null;???//如果賬戶密碼錯(cuò)誤返回空 ?? ?} ?? ? ?? ?//用戶存款 ?? ?public Account deposit(Long id, double money) { ?? ??? ?int find = searchId(index, id);當(dāng)前用戶數(shù)組下標(biāo) ?? ??? ?if(find >= 0) {?? ??? ??? ??? ??? ??? ??? ?//判斷賬戶是否存在 ?? ??? ??? ?accounts[find].deposit(money); ? ? ?//調(diào)用Account類的存款方法 //?? ??? ??? ?System.out.println("存款成功"); ?? ??? ??? ?return accounts[find]; ? ? ? ? ? ? //返回當(dāng)前對(duì)象 //?? ??? ??? ?accounts[find].setBalance(accounts[find].getBalance()+money); ?? ??? ?} //?? ??? ?else { //?? ??? ??? ?System.out.println("用戶不存在"); //?? ??? ?} ?? ??? ? ?? ??? ?return null;???//如果賬戶不存在返回空 ?? ?} ?? ? ?? ?//用戶取款 ?? ?public Account withdraw(Long id, String password, double money) { ?? ??? ?int find = searchIdPassword(index, id, password);//當(dāng)前用戶數(shù)組下標(biāo) ?? ??? ?if(find >= 0) {?? ??? ??//判斷賬戶密碼是否正確 ?? ??? ??? ? ?? ??? ??? ?accounts[find].withdraw(money);?? ??//調(diào)用當(dāng)前對(duì)象的取款方法?? ? //?? ??? ??? ?System.out.println("取款成功"); ?? ??? ??? ?return accounts[find];?? ?//返回當(dāng)前對(duì)象 ?? ??? ?} ?? ??? ?return null; ?? ?} ?? ?//設(shè)置透支額度 ?? ?public Account updateCeiling(Long id, String password, double money) { ?? ??? ?int find = searchIdPassword(index, id, password);//獲取當(dāng)前用戶數(shù)組下標(biāo) ?? ??? ?if((find >= 0) && (accounts[find].getType()) == 1){ ?//判斷賬戶號(hào)碼和密碼是否正確,賬戶類型是否為信用賬戶 ?? ??? ??? ?((CreditAccount)accounts[find]).setCeiling(((CreditAccount)accounts[find]).getCeiling() + money); //調(diào)用set方法設(shè)置透支額度 ?? ??? ??? ?return accounts[find]; ?? ??? ?} ?? ??? ?return null; ?? ?} ?? ? ?? ? ?? ?// ?轉(zhuǎn)賬功能 ?? ?// ?參數(shù):from轉(zhuǎn)出賬戶,passwordFrom 轉(zhuǎn)出賬號(hào)的密碼,to轉(zhuǎn)入賬戶,money轉(zhuǎn)賬的金額 ?? ?public boolean transfer(Long from, String passwordFrom, Long to, double money) { ?? ??? ?int find = searchIdPassword(index, from, passwordFrom); //轉(zhuǎn)賬賬戶數(shù)組下標(biāo) ?? ??? ?int find2 = searchId(index, to); ? ? ? ? ? ? ?//收款賬戶數(shù)組下標(biāo) ?? ??? ?if(find >= 0 && find2 >= 0 && accounts[find].getBalance() >= money) { ?//判斷轉(zhuǎn)賬賬戶密碼、收款賬戶是否匹配,判斷轉(zhuǎn)賬用戶余額是否足夠 ?? ??? ??? ??? ?accounts[find].withdraw(money);//轉(zhuǎn)賬用戶轉(zhuǎn)賬操作==取款 ?? ??? ??? ??? ?accounts[find2].deposit(money);//收款用戶 == 存款 ?? ??? ??? ??? ?return true; ?? ??? ?}? ?? ??? ?return false; ?? ?} ?? ? ?? ?//統(tǒng)計(jì)銀行所有賬戶余額總數(shù) ?? ?public double balanceSum() { ?? ??? ?double sum = 0; ? ? //初始化所有賬戶余額 ?? ??? ?for(int i = 0; i < index; i++) { ?//遍歷數(shù)組 ?? ??? ??? ?sum += accounts[i].getBalance();//求和(賬戶余額) ?? ??? ?} ?? ??? ?return sum; ?? ?} ?? ? ?? ?//統(tǒng)計(jì)所有信用賬戶透支額度總數(shù) ?? ?public double ceilingSum() { ?? ??? ?double sum = 0; ?//初始化所有透支額度和 ?? ??? ?for(int i = 0; i < index; i++) { ?//遍歷 ?? ??? ??? ?if(accounts[i].getType() == 1) { ?//判斷賬戶類型是否為信用賬戶 ?? ??? ??? ??? ?sum += ((CreditAccount)accounts[i]).getCeiling(); //求和 ?? ??? ??? ?} ?? ??? ?} ?? ??? ?return sum; ?? ?} ?? ?//搜索Id與密碼返回?cái)?shù)組下標(biāo)位置 ?? ?public int searchIdPassword(int index, Long id, String password) { ?? ??? ?for(int i = 0; i < index; i++) { ?? ??? ??? ?if(id.equals(accounts[i].getId()) && password.equals(accounts[i].getPassword())){ ?//比較賬戶和密碼是否匹配 ?? ??? ??? ??? ?return i ;?? //匹配則返回賬戶數(shù)組下標(biāo) ?? ??? ??? ?} ?? ??? ??? ? ?? ??? ?} ?? ??? ?return -1;?? ??//不匹配則返回-1 ?? ?} ?? ?//搜索Id ?? ?public int searchId(int index, Long id) { ?? ??? ?for(int i = 0; i < index; i++) { ?? ??? ??? ?if(id.equals(accounts[i].getId())){ ? //比較賬戶是否匹配 ?? ??? ??? ??? ?return i ;?? ??? ??? ??? ??? ??? ?//匹配則返回賬戶數(shù)組下標(biāo) ?? ??? ??? ?} ?? ??? ??? ? ?? ??? ?} ?? ??? ?return -1;?? ?//不匹配則返回-1 ?? ?} }
TestAccount.java
package com.task1; public class TestAccount { ?? ?public static void main(String[] args) { ?? ??? ?Account a =new Account(123456L, "123456","張三", "421356", "tt@tt.com", 100.0, 0); ?? ??? ?System.out.println(a);?? ??? ? ?? ?} }
TestBank.java
package com.task1; import java.util.Scanner; public class TestBank { ?? ?public static void main(String[] args) { ?? ??? ?Scanner sc = new Scanner(System.in); ?? ??? ?Bank bank = new Bank(); ?? ??? ?String action =null; ?? ??? ?do { ?? ??? ??? ?System.out.println("菜單:"); ?? ??? ??? ?System.out.println("---[1.開(kāi)戶]---"); ?? ??? ??? ?System.out.println("---[2.登錄](méi)---"); ?? ??? ??? ?System.out.println("---[3.存款]---"); ?? ??? ??? ?System.out.println("---[4.取款]---"); ?? ??? ??? ?System.out.println("---[5.設(shè)置透支額度]---"); ?? ??? ??? ?System.out.println("---[6.轉(zhuǎn)賬]---"); ?? ??? ??? ?System.out.println("請(qǐng)選擇服務(wù)"); ?? ??? ??? ?int choice =sc.nextInt(); ?? ??? ??? ? ?? ??? ??? ?switch(choice) { ?? ??? ??? ? ?? ??? ??? ??? ?case 1:?? ??? ??? ?//開(kāi)戶 ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶號(hào)碼:"); ?? ??? ??? ??? ??? ?Long id = sc.nextLong(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶密碼:"); ?? ??? ??? ??? ??? ?String password = sc.next(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)確認(rèn)賬戶密碼:"); ?? ??? ??? ??? ??? ?String repassword = sc.next(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入真實(shí)姓名:"); ?? ??? ??? ??? ??? ?String name = sc.next(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入身份證號(hào):"); ?? ??? ??? ??? ??? ?String personId = sc.next(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入電子郵箱:"); ?? ??? ??? ??? ??? ?String email = sc.next(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶類型:0 – 儲(chǔ)蓄賬戶 ?1 – 信用賬戶 2 – 可貸款儲(chǔ)蓄賬戶 3– 可貸款信用賬戶"); ?? ??? ??? ??? ??? ?int type = sc.nextInt(); ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?Account a1 = bank.register(id, password, repassword, name, personId, email, type); ?? ??? ??? ??? ??? ?if(a1 != null) { ?? ??? ??? ??? ??? ??? ?System.out.println(a1); ?? ??? ??? ??? ??? ??? ?System.out.println("開(kāi)戶成功"); ?? ??? ??? ??? ??? ?}else { ?? ??? ??? ??? ??? ??? ?System.out.println("兩次輸入密碼不一致"); ?? ??? ??? ??? ??? ?} ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ?case 2:?? ??? ??? ?//登錄 ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶號(hào)碼:"); ?? ??? ??? ??? ??? ?id = sc.nextLong(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶密碼:"); ?? ??? ??? ??? ??? ?password = sc.next(); ?? ??? ??? ??? ??? ?Account a2 = bank.login(id, password); ?? ??? ??? ??? ??? ?if(a2 != null) { ?? ??? ??? ??? ??? ??? ?System.out.println(a2); ?? ??? ??? ??? ??? ??? ?System.out.println("登錄成功"); ?? ??? ??? ??? ??? ?}else { ?? ??? ??? ??? ??? ??? ?System.out.println("賬戶號(hào)碼密碼錯(cuò)誤"); ?? ??? ??? ??? ??? ?} ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ?case 3:?? ??? ??? ?//存款 ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶號(hào)碼:"); ?? ??? ??? ??? ??? ?id = sc.nextLong(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入存款金額:"); ?? ??? ??? ??? ??? ?double money = sc.nextDouble(); ?? ??? ??? ??? ??? ?Account a3 = bank.deposit(id, money); ?? ??? ??? ??? ??? ?if(a3 != null) { ?? ??? ??? ??? ??? ??? ?System.out.println(a3); ?? ??? ??? ??? ??? ??? ??? ?System.out.println("存款成功"); ?? ??? ??? ??? ??? ?}else { ?? ??? ??? ??? ??? ??? ?System.out.println("賬戶不存在"); ?? ??? ??? ??? ??? ?} ?? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ?case 4:?? ??? ??? ?//取款 ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶號(hào)碼:"); ?? ??? ??? ??? ??? ?id = sc.nextLong(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶密碼:"); ?? ??? ??? ??? ??? ?password = sc.next(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入取款金額:"); ?? ??? ??? ??? ??? ?money = sc.nextDouble(); ?? ??? ??? ??? ??? ?Account a4 = bank.withdraw(id, password, money); ?? ??? ??? ??? ??? ?if(a4 != null ) { ?? ??? ??? ??? ??? ??? ?System.out.println(a4); ?? ??? ??? ??? ??? ??? ?System.out.println("取款成功"); ?? ??? ??? ??? ??? ?}else { ?? ??? ??? ??? ??? ??? ?System.out.println("賬戶號(hào)碼密碼錯(cuò)誤"); ?? ??? ??? ??? ??? ?} ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ?case 5://設(shè)置透支額度 ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶號(hào)碼:"); ?? ??? ??? ??? ??? ?id = sc.nextLong(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入賬戶密碼:"); ?? ??? ??? ??? ??? ?password = sc.next(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入透支金額:"); ?? ??? ??? ??? ??? ?money = sc.nextDouble(); ?? ??? ??? ??? ??? ?Account a5 = bank.updateCeiling(id, password, money); ?? ??? ??? ??? ??? ?if(a5 != null ) { ?? ??? ??? ??? ??? ??? ?System.out.println(a5); ?? ??? ??? ??? ??? ??? ?System.out.println("設(shè)置透支額度成功"); ?? ??? ??? ??? ??? ?}else { ?? ??? ??? ??? ??? ??? ?System.out.println("賬戶號(hào)碼密碼錯(cuò)誤或賬戶類型錯(cuò)誤"); ?? ??? ??? ??? ??? ?} ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ?case 6:// ?轉(zhuǎn)賬功能 ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入轉(zhuǎn)賬賬戶號(hào)碼:"); ?? ??? ??? ??? ??? ?Long from = sc.nextLong(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入轉(zhuǎn)賬賬戶密碼:"); ?? ??? ??? ??? ??? ?String passwordFrom = sc.next(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入收款賬戶號(hào)碼:"); ?? ??? ??? ??? ??? ?Long to = sc.nextLong(); ?? ??? ??? ??? ??? ?System.out.println("請(qǐng)輸入轉(zhuǎn)賬金額:"); ?? ??? ??? ??? ??? ?money = sc.nextDouble(); ?? ??? ??? ??? ??? ?boolean flag = bank.transfer(from, passwordFrom, to, money); ?? ??? ??? ??? ??? ?if(flag) { ?? ??? ??? ??? ??? ??? ?System.out.println("轉(zhuǎn)賬成功"); ?? ??? ??? ??? ??? ?}else { ?? ??? ??? ??? ??? ??? ?System.out.println("轉(zhuǎn)賬失敗"); ?? ??? ??? ??? ??? ?} ?? ??? ??? ??? ??? ? ?? ??? ??? ??? ??? ?break; ?? ??? ??? ??? ?default: ?? ??? ??? ??? ??? ?System.out.println("服務(wù)選擇錯(cuò)誤"); ?? ??? ??? ?} ?? ??? ??? ?System.out.println("是否繼續(xù)(y/n)?"); ?? ??? ??? ?action = sc.next(); ?? ??? ? ?? ??? ?}while("y".equals(action)); ?? ??? ? ?? ??? ?double balanceSum = bank.balanceSum(); ?? ??? ?double ceilingSum = bank.ceilingSum(); ?? ??? ?System.out.println("銀行所有賬戶余額總數(shù):"+balanceSum); ?? ??? ?System.out.println("所有信用賬戶透支額度總數(shù)"+ceilingSum); ?? ?} }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- java實(shí)現(xiàn)銀行ATM管理系統(tǒng)
- Java實(shí)現(xiàn)基礎(chǔ)銀行ATM系統(tǒng)
- Java簡(jiǎn)單實(shí)現(xiàn)銀行ATM系統(tǒng)
- java實(shí)現(xiàn)簡(jiǎn)單銀行ATM系統(tǒng)
- 基于java實(shí)現(xiàn)簡(jiǎn)單的銀行管理系統(tǒng)
- Java實(shí)現(xiàn)銀行ATM系統(tǒng)
- java銀行管理系統(tǒng)源碼
- java實(shí)現(xiàn)簡(jiǎn)單銀行管理系統(tǒng)
- java實(shí)現(xiàn)銀行管理系統(tǒng)
- Java 模擬銀行自助終端系統(tǒng)
相關(guān)文章
實(shí)例解析Java單例模式編程中對(duì)抽象工廠模式的運(yùn)用
這篇文章主要介紹了實(shí)例解析Java單例模式編程中對(duì)抽象工廠模式的運(yùn)用,抽象工廠模式可以看作是工廠方法模式的升級(jí)版,本需要的朋友可以參考下2016-02-02SpringBoot @Autowired注解注入規(guī)則介紹
這篇文章主要介紹了SpringBoot @Autowired注解注入規(guī)則介紹,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。2021-11-11Nacos服務(wù)注冊(cè)客戶端服務(wù)端原理分析
這篇文章主要為大家介紹了Nacos服務(wù)注冊(cè)客戶端服務(wù)端原理分析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪2023-02-02java性能優(yōu)化四種常見(jiàn)垃圾收集器匯總
這篇文章主要介紹了java性能優(yōu)化四種常見(jiàn)垃圾收集器匯總,每種垃圾收集器都有其不同的算法實(shí)現(xiàn)和步驟,下面我們簡(jiǎn)單描述下我們常見(jiàn)的四種垃圾收集器的算法過(guò)程,感興趣的同學(xué)們最好先看下以下的兩篇文章去增加理解2022-07-07Java利用DelayQueue實(shí)現(xiàn)延遲任務(wù)代碼實(shí)例
這篇文章主要介紹了Java利用DelayQueue實(shí)現(xiàn)延遲任務(wù)代碼實(shí)例,DelayQueue?是一個(gè)支持延時(shí)獲取元素的阻塞隊(duì)列,?內(nèi)部采用優(yōu)先隊(duì)列?PriorityQueue?存儲(chǔ)元素,同時(shí)元素必須實(shí)現(xiàn)?Delayed?接口,需要的朋友可以參考下2023-12-12Java實(shí)現(xiàn)FTP批量大文件上傳下載篇2
這篇文章主要為大家詳細(xì)介紹了Java實(shí)現(xiàn)FTP批量大文件上傳下載的強(qiáng)化篇,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-08-08總結(jié)十個(gè)實(shí)用但偏執(zhí)的Java編程技術(shù)
Java是世界上最流行的程序語(yǔ)言,從1995年問(wèn)世以來(lái),Java的生態(tài)系統(tǒng)在一直在蓬勃的發(fā)展著。下面這篇文章主要總結(jié)了十個(gè)實(shí)用但偏執(zhí)的Java編程技術(shù),需要的朋友可以參考借鑒,下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2017-01-01eclipse漢化及jdk安裝環(huán)境配置超詳細(xì)教程(Java安裝教程)
這篇文章主要介紹了eclipse漢化及jdk安裝環(huán)境配置超詳細(xì)教程(Java安裝教程),本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2021-03-03