java程序设计银行代码 java设计一个bank类实现银行

用java语言编写一个小型的银行系统代码private int balance = 0;
privateString username = "A";
privateString password = "B";
public void bank() {
Scanner scan = new Scanner(System.in);
Stringtemp;
while (true) {
System.out.println("输入账号:");
if (scan.hasNext()) {
temp = scan.next();
if (temp.equals(username)) {
break;
} else {
System.out.println("输入错误");
}
}
}
while (true) {
System.out.println("输入密码:");
if (scan.hasNext()) {
temp = scan.next();
if (temp.equals(password)) {
break;
} else {
System.out.println("输入错误");
}
}
}
System.out.println("登录成功");
while (true) {
System.out.println("输入操作:");
if (scan.hasNext()) {
temp = scan.next();
switch (temp) {
case "存款":
int x = 0;
while (true) {
System.out.println("输入存款金额:");
if (scan.hasNextInt()) {
x = scan.nextInt();
break;
} else {
System.out.println("输入错误");
scan.next();
}
}
balance += x;
break;
case "取款":
int y = 0;
while (true) {
System.out.println("输入取款金额:");
if (scan.hasNextInt()) {
y = scan.nextInt();
if (balancey) {
System.out.println("余额不足");
continue;
}
break;
} else {
System.out.println("输入错误");
scan.next();
}
}
balance -= y;
break;
case "余额":
System.out.println("余额:" + balance);
break;
case "终止":
System.exit(0);
default:
System.out.println("未知操作");
}
}
}
谁帮忙用JAVA设计一个银行类?。∫? ,在下感激不尽/**
* @author
* @version 创建时间java程序设计银行代码:Oct 15, 2009
* 类说明 About Bank
*/
public class Bank {
private String banksName;
private String banksAdds;
private String banksOther;
//等等......
public Bank() {
super();
}
public Bank(String banksName, String banksAdds, String banksOther) {
super();
this.banksName = banksName;
this.banksAdds = banksAdds;
this.banksOther = banksOther;
}
/**
* @return the banksName
*/
public String getBanksName() {
return banksName;
}
/**
* @param banksName the banksName to set
*/
public void setBanksName(String banksName) {
this.banksName = banksName;
}
/**
* @return the banksAdds
*/
public String getBanksAdds() {
return banksAdds;
}
/**
* @param banksAdds the banksAdds to set
*/
public void setBanksAdds(String banksAdds) {
this.banksAdds = banksAdds;
}
/**
* @return the banksOther
*/
public String getBanksOther() {
return banksOther;
}
/**
* @param banksOther the banksOther to set
*/
public void setBanksOther(String banksOther) {
this.banksOther = banksOther;
}
}
用java编的银行账户系统代码package pack.money.persistent;import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;import pack.money.entity.Client;
import pack.money.entity.ClientMessage;
public class ClientPersistent {
//private static int a=0;
private static String t,b;//t是passwordb是clinetname
private static ClientPersistent sp;
public static ClientPersistent getClientPersistent() {
if (sp == null) {
sp = new ClientPersistent();
}
return sp;
}
private ClientMessage getClientMessage(ResultSet rs) throws Exception{

推荐阅读