1. 用java语言编写一个小型的银行系统代码
private int balance = 0;private String username = "A";private String password = "B";public void bank() { Scanner scan = new Scanner(System.in); String temp; 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 (balance < y) { 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("未知操作"); } } }
2. JAVA编程简单的银行系统
public class Transation { private String tranType; // 定义交易类型
private String tranAccount; // 定义交易账号
private double tranAmount; // 定义交易金额 public Transation(String tranType, String tranAccount, double tranAmount) { // 定义构造函数
this.tranAccount = tranAccount;
this.tranAmount = tranAmount;
this.tranType = tranType;
} //定义得到和设置属性的方法
public String getTranType() {
return tranType;
} public void setTranType(String tranType) {
this.tranType = tranType;
} public String getTranAccount() {
return tranAccount;
} public void setTranAccount(String tranAccount) {
this.tranAccount = tranAccount;
} public double getTranAmount() {
return tranAmount;
} public void setTranAmount(double tranAmount) {
this.tranAmount = tranAmount;
}
}
3. JAVA 简单银行系统的代码
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class AccountDemo {
public static double MONEY = 0;// 初始化金额是100元。
public static void main(String[] args) {
final String USER_NAME = "zhangsan";// 用户名
final String PASSWORD = "123456";// 密码
while (true) {
System.out.print("请输入用户名:");
String user_name = getString();
System.out.print("请输入密码:");
String password = getString();
if (user_name != null && user_name.equals(USER_NAME)
&& password != null && password.equals(PASSWORD)) {
System.out.println("登陆成功!你要干什么?");
while (true) {
System.out.println("1:存款");
System.out.println("2:取款");
System.out.println("3:查询余额");
System.out.println("q:退出程序");
System.out.print("请选择:");
String userIn = getString();
int in = 0;
if (userIn != null && userIn.equals("1")) {
in = Integer.parseInt(userIn);
} else if (userIn != null && userIn.equals("2")) {
in = Integer.parseInt(userIn);
} else if (userIn != null && userIn.equals("3")) {
in = Integer.parseInt(userIn);
} else if (userIn != null
&& userIn.trim().toUpperCase().equals("Q")) {
in = 4;
} else {
System.out.println("你输入的指令不正确!请重新输入。");
continue;
}
switch (in) {
case 1:
double add_money = 0;
while (true) {
System.out.print("请输入你要存入的金额:");
try {
add_money = Double.parseDouble(getString());
} catch (Exception e) {
System.out.println("金额输入不正确!");
continue;
}
break;
}
MONEY += add_money;
System.out.println("存入的金额是" + add_money
+ "\r\n请选择你要的操作:");
break;
case 2:
double money = 0;
while (true) {
System.out.print("请输入你要取出的金额:");
try {
money = Double.parseDouble(getString());
} catch (Exception e) {
System.out.println("金额输入不正确!");
continue;
}
if (money > MONEY) {
System.out.println("取出的金额大于现有存款,请重新输入要取出的金额!");
continue;
}
break;
}
MONEY -= money;
System.out.println("取出的金额是" + money + "\r\n请选择你要的操作:");
break;
case 3:
System.out.println("你的余额是:" + MONEY + "\r\n请选择你要的操作:");
break;
case 4:
System.out.println("程序退出!");
return;
}
}
} else {
System.out.println("错误:用户名与密码不匹配!\r\n");
System.out.println("按任意键:重新输入用户名和密码。");
System.out.println("q:退出程序。");
System.out.print("请选择:");
String in = getString();
if (in.trim().toUpperCase().equals("Q")) {
break;
}
}
}
}
public static String getString() {
String str = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
str = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
return str;
}
}
4. 使用JAVA编写一个简单的银行存取款程序
package com.lw.thread;
/*
银行账户类Account(不能透支),
包含账号id(10~16位数字),密码password(6位数字),户主姓名name,余额balence
*/
public class Account {
private String id;
private int password;
private String name;
private double balence;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getPassword() {
return password;
}
public void setPassword(int password) {
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getBalence() {
return balence;
}
public void setBalence(double balence) {
this.balence = balence;
}
/*
* 默认构造账户信息为:1111111111111111,666666,钱三多,888888.88。
*/
public Account() {
super();
this.id = "1111111111111111";
this.password = 666666;
this.name = "钱三多";
this.balence = 888888.88;
}
/*
* 另一个构造方法带4个参数分别初始化4个属性(带数据有效性验证)。
*/
public Account(String id, int password, String name, double balence) {
this.id = id;
this.password = password;
this.name = name;
this.balence = balence;
}
/*
* 查询余额
*/
public static double selectMoney(Account account) {
return account.getBalence();
}
/*
* 存钱
*/
public static String setMoney(Account account, double balence) {
if (balence < 0) {
return "存钱失败,请正确放入!";
}
double d = balence + account.getBalence();
account.setBalence(d);
return "您存入了" + balence + "元,现账户余额为+" + d;
}
/*
* 取钱
*/
public static String getMoney(Account account, double balence) {
double d = account.getBalence();
if (balence > d) {
return "您的余额不足!";
}
account.setBalence(d - balence);
return "您取出了" + balence + "元,现账户余额为+" + account.getBalence();
}
}
5. 用java写一个仿银行系统
这个也就太简单了, 不牵涉实际的业务逻辑的话 ,实际上就是创建数据库,写一个用户界面, 脱离了柜台业务逻辑后 事实上也就跟一个论坛的用户管理形式差不多了
实在是没写的心情, lz 如果这是你的作业, 最好自己写一下 , 印象会深很多
6. 用java编写银行管理系统
你会了吧给我下答案呗
7. java用来编写简单的银行程序
很简单的入门程序。最好自己写吧,提高下自己。这里没有涉及到任何复杂的算法。
8. 用java开发的银行系统
数据库应该是oracle 集群版,做开发只需要了解基本sql语句就可以了,不可能让你直接写sql语句,都是封装好的,并且持久层是使用jpa来实现的
框架,使用的经典ejb,前端根据B/s和C/s的系统有所不同。
开发工具使用eclipse的比较多,但有的公司使用jbuilder (比较有钱的公司)