atm java课程设计(如何用Java编写模拟ATM取款机的程序)

本文目录
- 如何用Java编写模拟ATM取款机的程序
- 用java做一个简易的ATM机具体流程在下面
- Java编程自动取款机步骤
- 求高手用JAVA编写一个模拟ATM机取款业务需求如下:
- 用java编写的ATM机源代码
- 关于用JAVA编程ATM模拟程序问题
- Java编程实现程序用于模拟ATM取款机
- 使用Java语言进行面向对象设计:ATM柜员机模拟程序
- JAVA设计虚拟ATM机其中数据库怎么设计(详细的数据库设计)知道的告诉我一下!谢谢拉
如何用Java编写模拟ATM取款机的程序
import java.io.IOException;
/**
* ATM机类
*
* 查看余额
*
* 取款
*
* 存款
*
* 退出系统
*
*
*
*/
public class ATM {
static double yue = 1200.00;
public static void main(String arg) {
ATM localTest1 = new ATM();
localTest1.ATM_Operate();
}
/**
* ATM机的操作
*/
private void ATM_Operate() {
System.out.println("欢迎使用中国工商银行ATM取款机");
System.out.println("1、查看余额 2、取款");
System.out.println("3、存款 0、退出");
System.out.print("请输入您需要的服务:");
byte;
try {
int count = System.in.read(buffer);// 返回实际读取的字节数
System.out.print("您输入的是:");
for (int i = 0; i 《 count; i++) {
System.out.print("" + (char) buffer);
}
if ((char) buffer == ’1’) {
// 查看余额
System.out.println("您的余额是:¥" + yue + "元");
System.out.println();
ATM_Operate();
} else if ((char) buffer == ’2’) {
// 取款
withdrawal();
System.out.println();
ATM_Operate();
} else if ((char) buffer == ’3’) {
// 存款
deposit();
System.out.println();
ATM_Operate();
} else if ((char) buffer == ’0’) {
// 退出
System.out.println("您已经成功退出系统,谢谢你的使用");
System.exit(0);
} else {
System.out.println("输入不合法,请重新输入");
System.out.println();
ATM_Operate();
}
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* 取款
*
* @throws IOException
*/
private void withdrawal() throws IOException {
byte;
System.out.print("请输入您要取出的金额:¥");
int count2 = System.in.read(buffer);// 返回实际读取的字节数
System.out.print("您输入的金额是:");
for (int i = 0; i 《 count2 - 1; i++) {
System.out.print("" + (char) buffer);
}
System.out.println();
// 字符0 ~ 9对应ASCII值48 ~ 57
boolean flag = false;
for (int i = 0; i 《 count2 - 1; i++) {
if ((char) buffer 《 58) {
if (i == count2 - 2) {
flag = true;
}
} else {
// 输入的字符不是数值
System.out.println("输入不合法,请重新输入");
withdrawal();
break;
}
}
System.out.println();
if (flag) {
System.out.print("您已成功取出¥:");
String num = "";
for (int i = 0; i 《 count2 - 1; i++) {
System.out.print("" + (char) buffer);
num += (char) buffer;
}
yue -= Double.valueOf(num);
System.out.print(",现在余额¥:" + yue);
}
}
/**
* 存款
*
* @throws IOException
*/
private void deposit() throws IOException {
byte;
System.out.print("请输入您要存入的金额:¥");
int count2 = System.in.read(buffer);// 返回实际读取的字节数
System.out.print("您输入的金额是:");
for (int i = 0; i 《 count2 - 1; i++) {
System.out.print("" + (char) buffer);
}
System.out.println();
// 字符0 ~ 9对应ASCII值48 ~ 57
boolean flag = false;
for (int i = 0; i 《 count2 - 1; i++) {
if ((char) buffer 《 58) {
if (i == count2 - 2) {
flag = true;
}
} else {
// 输入的字符不是数值
System.out.println("输入不合法,请重新输入");
withdrawal();
break;
}
}
System.out.println();
if (flag) {
System.out.print("您已成功存入¥:");
String num = "";
for (int i = 0; i 《 count2 - 1; i++) {
System.out.print("" + (char) buffer);
num += (char) buffer;
}
yue += Double.valueOf(num);
System.out.print(",现在余额¥:" + yue);
}
}
}
用java做一个简易的ATM机具体流程在下面
代码如下
package BaiDdu;
import java.util.Scanner;
public class ATM {
/*1提示请输入密码然后直接进入下一步。密码6位限制(限制方法用 “最小大于100000最大小于999999”这样限制)
2.提示密码正确还是错误密码直接弄成“123456”错误返回上一步循环方法用for循环。
3.密码输入正确后进入下一步提示5个选项(1.余额查询“基础10000”2.取款 3存款4.退出)
4.进行取款或者存款之后要回到第三步重新选择(余额和取款存款相关联)
备注:用键盘输入的方法用scanner*/
private static int money=10000;//全局变量 余额 默认10000
public static void main(String args)
{
for(;;){//for循环,有意思吗?
System.out.println("请输入密码:");
Scanner input=new Scanner(System.in);
int pw=input.nextInt();
if ( Checkpw(pw)) {
System.out.println("密码正确。");
Next();
}
else System.out.println("密码错误!");
}
}
public static boolean Checkpw(int pw)
{
if (pw==123456)return true;//固定密码就不需要限制位数了,反正不符合就错
else
return false;
}
public static void Next() {
do {
System.out.println("请选择你需要的功能:");
System.out.println("1.余额查询 2.取款 3.存款 4.退出");
int value = new Scanner(System.in).nextInt();
switch (value) {
case 1:// 查询余额
System.out.println("您的余额为 "+money+"元");
break;
case 2:// 取款
System.out.println("请输入取款金额:");
int getnum=new Scanner(System.in).nextInt();
if (getnum《0) System.out.println("输入金额有误!");
else if(getnum》money)System.out.println("余额不足.");
else {money=money-getnum;System.out.println("取款成功,余额为"+money);}
break;
case 3:// 存款
System.out.println("请输入存款金额:");
int pushnum= new Scanner(System.in).nextInt();
if (pushnum《0) System.out.println("输入金额有误!");
else {money=money+pushnum;System.out.println("存款成功,余额为"+money);}
break;
case 4:// 退出
System.out.println("谢谢使用!");
System.exit(0);
break;
default:
System.out.println("输入有误");
break;
}
}while(true);
}
}
2、运行效果
Java编程自动取款机步骤
Java编写的模拟ATM取款机程序/*** @version 1.0
* @author Devil_Angel
* 该程序的功能为实现模拟银行ATM自动取款机提款,查询等功能.
*
*/import java.io.*;/*该类为实现客户信息及部分功能*/
class Account {
private String code =null; //信用卡号
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;
}
/*得到剩余的钱的数目*/
protected void set_Balance(double mon) {
money -= mon;
}
}/**********实现具体取款机功能*********/
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模拟自动取款机程序.\n"+str+"\n");
System.out.print(" 1.》取款."+"\n"+
" 2.》查询信息."+"\n"+
" 3.》密码设置."+"\n"+
" 4.》退出系统."+"\n");
}
/**********登陆系统**********/
protected void Load_Sys() throws Exception
{
String card,pwd;
int counter=0;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
do {
System.out.println("请输入您的信用卡号:");
card=br.readLine();
System.out.println("请输入您的密码:");
pwd=br.readLine();
if(!isRight(card,pwd))
{
System.out.println("您的卡号或密码输入有误.");
counter++;
}
else
SysOpter();
}while(counter《3);
Lock_Sys();
}
/**********系统操作**********/
protected void SysOpter() throws Exception
{
int num;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("请选择您要操作的项目(1-4):");
num=br.read(); //num为ASICC码转换的整数
switch(num) {
case 49: BetBalance(); break;
case 50: Inqu_Info(); break;
case 51: Set_Password(); break;
case 52: Exit_Sys(); break;
}
System.exit(1);
}
/**********信息查询**********/
protected void Inqu_Info() {
System.out.print("---------------------\n"+
act.get_Code()+"\n"+
act.get_Name()+"\n"+
act.get_Money()+"\n"+
"-----------------------");
}
/**********取款**********/
public void BetBalance() throws Exception
{
String str=null,str1;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
do {
System.out.println("请输入您要取的数目:");
str=br.readLine();
str1=String.valueOf(act.get_Money());
if(str.compareTo(str1)》0) {
System.out.println("超过已有的钱数,请重新输入您要取的数目:");
}
else {
/*操作成功*/
// act.set_Balance(str);
System.out.println("取款成功,请收好您的钱.");
Welcome();
SysOpter();
}
}while(true);
}
/**********判断卡内是否有钱**********/
protected boolean isBalance() {
if(act.get_Money()《0) {
// System.out.println("对不起,您的钱数不够或卡已透支.");
return false;
}
return true;
}
/********卡号密码是否正确******/
protected boolean isRight(String card,String pwd)
{
if(act.get_Code().equals(card) && act.get_Password().equals(pwd))
return true;
else
return false;
}
/**********密码修改**********/
protected void Set_Password() throws Exception
{
String pwd=null;
int counter=0;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
do {
System.out.println("请输入旧密码:");
pwd=br.readLine();
if(act.get_Password().equals(pwd))
{
do {
System.out.println("请输入新密码:");
String pwd1=br.readLine();
System.out.println("请再次输入新密码:");
String pwd2=br.readLine();
if(!pwd1.equals(pwd2))
{
System.out.println("两次输入不一致,请再次输入.");
}
else
{
System.out.println("密码修改成功,请使用新密码.");
Welcome();
SysOpter();
}
}while(true);
}
}while(counter》3);
}
/**********锁定机器**********/
protected void Lock_Sys() {
System.out.println("对不起,您的操作有误,卡已被没收.");
System.exit(1);
}
/**********结束系统**********/
protected void Exit_Sys() {
System.out.println("感谢您使用本系统,欢迎下次在来,再见!");
System.exit(1);
}
}public class Text
{
public static void main(String args) throws Exception
{
ATM atm=new ATM();
atm.Welcome();
atm.Load_Sys();
// atm.Exit_Sys();
}
} //模拟ATM取款机工作流程 import java.util.Scanner;public class Atm {
public Atm() {
}
public static void main(String args) {
// TODO code application logic here
Scanner sc = new Scanner(System.in);
int password = 0;
int count = 0;
int choice = 0;
int type = 0;
int input = 0;
int acount = 1000;
boolean exit = false;
int flag = 0;
do{
System.out.println("请输入您的密码:");
password = sc.nextInt();
count++;
}while(password != 12345 && count《3);
if(password == 12345){
//密码正确继续后面的操作。
do{
System.out.println("请选择您的操作,1.查询 2.取款");
choice = sc.nextInt();
switch(choice){
case 1:
do{
System.out.println("请选择帐户类型:1. 美元 2. 人民币");
type = sc.nextInt();
if(type == 1){
System.out.println("You have $"+acount+"!");
}else if(type == 2){
System.out.println("您有"+acount+"圆!");
}else{
System.out.println("类型选择错误,请重新选择!");
}
System.out.println("1.继续 2.离开");
flag = sc.nextInt();
if(flag == 1){
exit = false;
}else{
exit = true;
}
}while(type!=1 && type!=2);
break;
case 2: do{
System.out.println("请选择帐户类型:1. 美元 2. 人民币");
if(type == 1){
System.out.println("Please input number of your money!");
input = sc.nextInt();
if(input 》 acount){
System.out.println("You have not enough money!");
}else{
System.out.println("You take care of your money!");
}
System.out.println("1.continue 2.exit");
flag = sc.nextInt();
if(flag == 1){
exit = false;
}else{
exit = true;
}
}else if(type == 2){
System.out.println("请输入您要取的金额!");
input = sc.nextInt();
if(input 》 acount){
System.out.println("您的余额不足!");
}else{
System.out.println("请妥善保管您的钱!");
acount = acount - input;
}
System.out.println("1.继续 2.离开");
flag = sc.nextInt();
if(flag == 1){
exit = false;
}else{
exit = true;
}
}else{
System.out.println("类型选择错误,请重新选择!");
}
}while(type!=1 && type!=2);
break;
default: System.out.println("类型选择错误,请重新选择!");
}
}while(choice!=1 && choice!=2 || exit == false);
}else{
//密码错误,退出。
System.out.println("三次密码错误,吞卡!");
}
}
}
求高手用JAVA编写一个模拟ATM机取款业务需求如下:
楼主您好,编码如下,直接运行即可:
import java.util.Scanner;
public class AtmGetMoney {
public static void main(String args) {
String password = "111111";
int count = 0;
int a = 0;
while(count《3){
System.out.println("请输入银行卡密码: ");
Scanner scan = new Scanner(System.in);
String passwd = scan.nextLine();
while(passwd.equals(password)){
System.out.println("请输入取款金额: ");
int amount = scan.nextInt();
if(amount%100 == 0 && amount 《= 1000){
System.out.println("您的取款金额为: "+amount);
System.out.println("交易完成,请读卡!");
a = a + 1;
break;
}
else {
System.out.println("只能提取100元纸币,要求最低0,最高1000!");
continue;
}
}
if (a == 1){
break;
}
else if (count 《 2) {
System.out.println("银行卡密码错误");
count = count + 1;
continue;
}
else {
System.out.println("密码错误请读卡");
break;
}
}
}
}
用java编写的ATM机源代码
/** * @author admin * 该程序的功能为实现模拟银行ATM自动取款机提款,查询等功能. */ import Java.io.*; /*该类为实现客户信息及部分功能*/ class Account { private String code =null; //信用卡号 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; } /*得到剩余的钱的数目*/ protected void set_Balance(double mon) { money -= mon; } } /**********实现具体取款机功能*********/ 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模拟自动取款机程序.\n" str "\n"); System.out.print(" 1.》取款." "\n" " 2.》查询信息." "\n" " 3.》密码设置." "\n" " 4.》退出系统." "\n"); } /**********登陆系统**********/ protected void Load_Sys() throws Exception { String card,pwd; int counter=0; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); do { System.out.println("请输入您的信用卡号:"); card=br.readLine(); System.out.println("请输入您的密码:"); pwd=br.readLine(); if(!isRight(card,pwd)) { System.out.println("您的卡号或密码输入有误."); counter ; } else SysOpter(); }while(counter《3); Lock_Sys(); } 回复获取全部
关于用JAVA编程ATM模拟程序问题
/*
要求:使用字符用户界面。当输入给定的卡号和密码(初始卡号和密码为123456)时,系统能登录ATM柜员机系统,用户可以按照以下规则进行:
1、查询余额:初始余额为10000元
2、ATM取款:每次取款金额为100的倍数,总额不超过5000元,支取金额不允许透支。
3、ATM存款:不能出现负存款。
4、修改密码:新密码长度不小于6位,不允许出现6位完全相同的情况,只有旧密码正确,新密码符合要求,且两次输入相同的情况下才可以成功修改密码。
(卡号密码余额放到文件中)
*/
public class ATM {
private Account acc;
private File dataFile;
private FileWriter fw;
private BufferedWriter bw;
private String filePath = "./data.txt";
public ATM() {
this.acc = new Account();
try {
this.dataFile = new File(this.filePath);
if (!this.dataFile.exists()) {
this.dataFile.createNewFile();
}
this.fw = new FileWriter(this.filePath);
this.bw = new BufferedWriter(this.fw);
} catch (IOException io) {
System.err.println("Cannot open file");
io.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String args) {
new ATM().interact();
}
public void interact() {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Account #: ");
String temp = br.readLine();
System.out.println("Password: ");
String temp2 = br.readLine();
if (!this.acc.isValid(Long.parseLong(temp.trim()), temp2.trim()) {
System.err.println("Wrong password");
return;
}
System.out.println("1. Account Inquery.");
System.out.println("2. Withdraw");
System.out.println("3. Deposit.");
System.out.println("4. Change Password.");
System.out.println("5. Export to File.");
System.out.println("0. Exit.");
int c = 100;
while (c != 0) {
String str = br.readLine();
try {
int c = Integer.parseInt(str.trim());
} catch (NumberFormatException nfe) {
System.err.println("Invalid choice");
continue;
}
switch (c) {
case 0:
System.out.println("Thank you");
break;
case 1:
System.out.println("Balance: " + this.acc.balanceInquery());
break;
case 2:
System.out.println("How much? ");
String temp = br.readLine();
try {
long ammount = Long.parseLong(temp.trim());
this.acc.withdraw(ammount);
break;
} catch (NumberFormatException nfe) {
System.err.println("Invalid amount");
continue;
}
case 3:
System.out.println("How much? ");
String temp = br.readLine();
try {
long ammount = Long.parseLong(temp.trim());
this.acc.deposit(ammount);
break;
} catch (NumberFormatException nfe) {
System.err.println("Invalid amount");
continue;
}
case 4:
System.out.println("Old password: ");
String temp = br.readLine();
System.out.println("New password: ");
String temp2 = br.readLine();
this.acc.changePassword(temp, temp2);
break;
case 5:
this.bw.write(this.acc.toString());
break;
default:
break;
}
}
}
}
class Account {
private long accNo = 123456;
private String pass = "123456";
private long balance = 10000;
public Account() {
}
public boolean isValid(long accNo, String pass) {
return (this.accNo == accNo) && (pass.equals(this.pass));
}
public void changePassword(String oldPass, String password) {
if (!oldPass.equals(this.pass)) {
System.err.println("Wrong password.");
return;
}
if (password.length 《 6) {
System.err.println("Password too short");
return;
}
if (password.equals(this.pass)) {
System.err.println("Password cannot be the same.");
return;
}
this.pass = password;
}
public long balanceInquery() {
return this.balance;
}
public void withdraw(long amount) {
if (amount 》 5000 || amount 《 0) {
System.err.println("Withdraw limit: $0-$5000");
return;
}
if ((amount % 100) != 0) {
System.err.println("The amount has to be a product of 100");
return;
}
long newBalance = this.balance - amount;
if (newBalance 《 0) {
System.err.println("Not enough money in the account");
return;
}
this.balance = newBalance;
}
public void deposit(long amount) {
if (amount 《 0) {
System.err.println("Cannot deposit negative amount");
return;
}
this.balance += amount;
}
public String toString() {
return ("Account #: " + this.accNo + "\n" + "Password: " + this.pass + "\n" + "Balance: " + this.balance);
}
}
Java编程实现程序用于模拟ATM取款机
package demo;
import java.util.Scanner;
public class Test3 {
public static void main(String args) {
Scanner scanner =new Scanner(System.in);
int cnt=3;
String username = null;
String password = null;
double money = 1000;
String targetName = "admin33";
double targetMoney = 1000;
while(true){
if(username!=null&&password!=null){
if("admin".equals(username) && "123".equals(password)){
System.out.println("欢迎光临");
while(true){
System.out.println("请选择您的操作 1 取钱 2 存钱 3 转账 4 查询 5 退出 ");
int n = scanner.nextInt();
if(n==1){//取钱
System.out.println("请输入金额");
int getter = scanner.nextInt();
if(getter》=0){
if(getter《=5000){
if(getter《=money){
money-=getter;
}else{
System.out.println("余额不足");
}
}else{
System.out.println("单笔只能取5000及以下");
}
}else{
System.out.println("银行不到给");
}
}else if(n==2){//存钱
System.out.println("请输入金额");
int save = scanner.nextInt();
if(save》=0){
money+=save;
}
}else if(n==3){//转账
System.out.println("请输入目标账户");
String target = scanner.next();
if(target.equals(targetName)){
System.out.println("请输入金额");
int getter = scanner.nextInt();
if(getter》=0){
if(getter《=5000){
if(getter《=money){
money-=getter;
targetMoney+=getter;
}else{
System.out.println("余额不足");
}
}else{
System.out.println("单笔只能取5000及以下");
}
}else{
System.out.println("银行不到给");
}
}
}else if(n==4){//查询
System.out.println(money);
}else if(n==5){//退出
System.exit(0);
}else{
System.out.println("没有该项服务");
}
}
}else{
cnt--;
System.out.println("输入错误,您还有"+cnt+"次机会");
username=null;
password=null;
if(cnt《=0){
System.out.println("对不起,您的账号被冻结,请到最近的营业厅解除冻结");
System.exit(0);
}
}
}else{
System.out.println("请输入您的账号");
username = scanner.next();
System.out.println("请输入您的密码");
password = scanner.next();
}
}
}
}
使用Java语言进行面向对象设计:ATM柜员机模拟程序
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class AtmSystem extends JFrame implements ActionListener
{
private JPanel buttonPanel=new JPanel();
private JPanel area1Panel=new JPanel();
private JPanel area2Panel=new JPanel();
private JTextField note=new JTextField(33);
private JButton buttons;
private JButton dot = new JButton(".");
private JButton doublezero = new JButton("00");
private JButton ok = new JButton("确定");
private JButton exit = new JButton("退出");
private JButton cancel = new JButton("取消");
private JButton change=new JButton("更正");
private JButton getmoney = new JButton("取款");
private JButton search = new JButton("查询余额");
private JButton changekey = new JButton("修改密码");
private JButton putmoney= new JButton("存款");;
private boolean flag0, flag1, flag2,flag3,flag4;
int status=0;
int k,s,k1;
String str1="\t欢迎使用ATM柜员机!";
String str2="\t请输入用户名:";
String str3="\t请输入密码:";
String str4="\t请输入取款金额:";
String str5="\t请输入存款金额:";
String str6="\t请输入新密码:";
String str7="\t您的余额为:";
String str8="\t用户名错误,请重新输入:";
String str9="\t密码错误,请重新输入:";
String str10="\t余额不足,请重新输入:";
String str11="\t密码修改成功!";
String store1="",store2="";
double moneysum=10000;
double getMoney;
String username="123456";
String password="123456";
public AtmSystem()
{
super("ATM柜员机");
Container container=getContentPane();
buttons=new JButton;
dot.addActionListener(this);
doublezero.addActionListener(this);
change.addActionListener(this);
cancel.addActionListener(this);
ok.addActionListener(this);
exit.addActionListener(this);
changekey.addActionListener(this);
putmoney.addActionListener(this);
getmoney.addActionListener(this);
search.addActionListener(this);
area2Panel.add(changekey);
area2Panel.add(putmoney);
area2Panel.add(getmoney);
area2Panel.add(search);
area2Panel.setLayout(new GridLayout(1,3));
container.add(area2Panel,BorderLayout.NORTH);
note.setText(str1);
note.setEditable(false);
area1Panel.add(note);
buttonPanel.setLayout(new GridLayout(4,4));
for(int count=0;count《buttons.length;count++)
{
buttons=new JButton(""+count);
buttons.addActionListener(this);
buttonPanel.add(buttons);
}
buttonPanel.add(doublezero);
buttonPanel.add(dot);
buttonPanel.add(change);
buttonPanel.add(cancel);
buttonPanel.add(ok);
buttonPanel.add(exit);
container.add(buttonPanel,BorderLayout.SOUTH);
container.add(area1Panel);
area1Panel.setVisible(true);
area2Panel.setVisible(false);
setSize(400,250);
setVisible(true);
}
public void actionPerformed(ActionEvent event)
{
JButton operation = (JButton) event.getSource();
if(operation==ok)
{
if(status==0)
{
note.setText(""+str2);
status=1;
}
else if(flag4==true)
{
area2Panel.setVisible(true);
area1Panel.setVisible(false);
flag4=false;
}
else if(status==1&&k==1)
{
note.setText(""+str3);
status=2;
k=0;
}
else if(status==1&&k==0)
{
note.setText(""+str8);
store1="";
}
else if(status==2&&k1==1)
{
k1=0;
area1Panel.setVisible(false);
area2Panel.setVisible(true);
status=3;
}
else if(status==2&&k1==0)
{
note.setText(""+str9);
store2="";
}
else if(status==3)
{
if(flag0==true)
{
getMoney=Double.valueOf(store1).doubleValue();
if(getMoney《moneysum)
{
area2Panel.setVisible(true);
area1Panel.setVisible(false);
flag0=false;
moneysum=moneysum-getMoney;
}
else
{
area2Panel.setVisible(false);
area1Panel.setVisible(true);
note.setText(""+str10);
store1="";
}
}
else if(flag1==true)
{
area2Panel.setVisible(true);
area1Panel.setVisible(false);
flag1=false;
}
else if(flag2==true)
flag2=false;
else if(flag3=true)
{
flag4=true;
note.setText(""+str11);
password=store2;
flag3=false;
}
}
}
else if(operation==cancel)
{
if(status==1)
{
note.setText(""+str1);
status=0;
store1="";
store2="";
}
else if(status==2)
{
note.setText(""+str2);
status=1;
store1="";
store2="";
}
else if(status==3&&flag2)
{
area1Panel.setVisible(false);
area2Panel.setVisible(true);
flag2=false;
store1="";
store2="";
}
else if(status==3&&flag0)
{
area1Panel.setVisible(false);
area2Panel.setVisible(true);
flag0=false;
store1="";
store2="";
}
else if(status==3&&flag3)
{
area1Panel.setVisible(false);
area2Panel.setVisible(true);
flag3=false;
store1="";
store2="";
}
}
else if(operation==change)
{
if(status==1)
{
note.setText(""+str2);
store1="";
store2="";
}
else if(status==2)
{
note.setText(""+str3);
store1="";
store2="";
}
else if(status==3&&flag2)
{
note.setText(""+str5);
store1="";
store2="";
}
else if(status==3&&flag0)
{
note.setText(""+str4);
store1="";
store2="";
}
else if(status==3&&flag3)
{
note.setText(""+str6);
store1="";
store2="";
}
}
else if(operation==doublezero&&status==3&&flag0==true)
{
note.setText(note.getText()+"00");
}
else if(operation==dot&&status==3&&flag0==true)
{
note.setText(note.getText()+".");
}
else if(operation==getmoney)
{
note.setText(""+str4);
area2Panel.setVisible(false);
area1Panel.setVisible(true);
store1="";
flag0=true;
}
else if(operation==search)
{
note.setText(""+str7+moneysum);
area2Panel.setVisible(false);
area1Panel.setVisible(true);
flag1=true;
}
else if(operation==putmoney)
{
note.setText(""+str5);
area2Panel.setVisible(false);
area1Panel.setVisible(true);
flag2=true;
}
else if(operation==changekey)
{
note.setText(""+str6);
area2Panel.setVisible(false);
area1Panel.setVisible(true);
store2="";
flag3=true;
}
else if(operation==exit)
{
note.setText(""+str1);
area2Panel.setVisible(false);
area1Panel.setVisible(true);
status=0;
flag0=flag1=flag2=flag3=flag4=false;
store1="";
store2="";
k=k1=s=0;
}
else if(status==1||(status==3&&flag2==true)||(status==3&&flag0==true))
{
for(int count=0;count《buttons.length;count++)
if (operation== buttons)
{
note.setText(note.getText() + count);
store1+=event.getActionCommand();
}
user(store1);
}
else if(status==2||(status==3&&flag3==true))
{
for(int count=0;count《buttons.length;count++)
if (operation== buttons)
{
note.setText(note.getText()+ "*");
store2+=event.getActionCommand();
}
key(store2);
}
}
public void user(String load)
{
if(username.equals(load))
{
k=1;
s=1;
}
}
public void key(String load)
{
if(password.equals(store2))
{
k1=1;
}
}
public static void main(String args)
{
AtmSystem application=new AtmSystem();
application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
JAVA设计虚拟ATM机其中数据库怎么设计(详细的数据库设计)知道的告诉我一下!谢谢拉
最后一列为备注
1、管理员表(tb_admin)
字段类型约束备注
aIdnumber(6)主键--管理员编号
aNamevarchar2(10)唯一、非空--管理员登陆名
aPasswordvarchar2(16)非空--管理员登陆密码
aLastDatedate非空--上次登陆时间
aNowDatedate非空--本次登陆时间
2、银行卡登陆表(tb_login)
字段类型约束备注
lIdnumber(8)主键--登录ID
lCardNumbervarchar2(19)引用银行卡信息表卡号
lPasswordnumber(6)非空银行卡密码
bIsLockchar(1)默认1是否被锁,0表示被锁,1表示开启
lTimenumber(10)初始为0登陆次数
aLastDatedate非空上次登陆时间
aNowDatedate非空本次登陆时间
3、客户详细资料表(tb_userInfo)
字段类型约束备注
usIdnumber(8)主键客户ID
usNamevarchar2(10)非空客户姓名
usIDNumbervarchar2(18)非空客户身份证号码
usSexchar(1)默认0客户性别,0表示男,1表示女
usTelvarchar2(11)非空客户电话
usAddressvarchar2(50)非空客户地址
4、银行支行表(tb_Branch)
字段类型约束备注
bIdnumber(3)主键支行ID
bNamevarchar2(20)唯一、非空支行名
bAddressvarchar2(100)非空支行地址
5、银行卡信息表(tb_CardInfo)
字段类型约束备注
bCardIDnumber(19)主键卡号
bBalancenumber(8,2)默认0.00余额
bUserIdnumber(8)引用客户详细资料表卡对应用户ID
bBranchIDnumber(4)引用支行表支行ID
bDatedate默认系统时间开户时间
6、银行卡交易类型表(tb_TransType)
字段类型约束备注
tIdnumber(2)主键类型ID
tTypenvarchar2(6)唯一类型(转账、存款、取出等)
7、银行卡个人账户存、取款记录表(tb_ Pacount)
字段类型约束备注
tIdnumber(10)主键交易记录流水号
tTypenumber(2)引用交易类型表交易类型ID
tCardIDnumber(19)引用银行卡信息表交易卡号
tamountnumber(10)非空交易金额
tDatedate非空交易时间
8、银行卡转账等交易记录表(tb_TransInfo)
字段类型约束备注
tIdnumber(10)主键交易记录流水号
tTypenumber(2)引用交易类型表交易类型ID
tCardIDoutnumber(19)引用银行卡信息表交易金额转出卡号
tCardIDInnumber(19)引用银行卡信息表交易金额转入卡号
tamountnumber(10)非空交易金额
tDatedate非空交易时间

更多文章:
cocos creator中文(cocoscreator和cocoscreator3d的区别)
2026年9月22日 02:30
方舟生存进化新物种图鉴中英文对照图鉴 庞马资料图鉴 庞马(Equus magnus)?植物大战僵尸英文版图鉴
2026年9月22日 00:10
html document对象(载入浏览器的html文档都会成为document的对象吗)
2026年9月21日 16:00
安装包怎样下载mysql(如何在官网上下载可安装版的MySQL数据库)
2026年9月21日 15:30
威廉尖叫音效在线(渴求《勇敢的心》的配乐a gift of a thistle下载)
2026年9月21日 15:20





