简单ATM机功能实现及感想
String l;
l=scan.next();
import java.io.FileReader;
import java.io.FileWriter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.StringTokenizer;
static int M=0,N=0;
private String accountname;//账户名称
private String operatedate;//2018-09-20
private int operatetype;//操作账户类型(1,存款2,取款3,转账汇款4,修改账户密码5,查询余额
private String accountpassword;//用户密码
private int accountbalance;//存储账户余额 0
private int amount;//流水金额
void setaccountID(String t)
{
accountID=t;
}
void setaccountname(String t)
{
accountname=t;
}
void setoperatedate(String t)
{
operatedate=t;
}
void setoperatetype(int t)
{
operatetype=t;
}
void setaccountpassword(String t)
{
accountpassword=t;
}
void setaccountbalance(int t)
{
accountbalance=t;
}
void amount(int t)
{
amount=t;
}
String getaccountID()
{
return accountID;
}
String getaccountname()
{
return accountname;
}
String getoperatedate()
{
return operatedate;
}
int getoperatetype()
{
return operatetype;
}
String getaccountpassword()
{
return accountpassword;
}
int getaccountbalance()
{
return accountbalance;
}
int getamount()
{
return amount;
}
Account(String AaccountID,String Aaccountname,String Aoperatedate,int Aoperatetype,String Aaccountpassword,int Aaccountbalance,int Aamount)
{
accountID=AaccountID;
accountname=Aaccountname;
operatedate=Aoperatedate;
operatetype=Aoperatetype;
accountpassword=Aaccountpassword;
accountbalance=Aaccountbalance;
amount=Aamount;
}
public static void main(String[]args)
{
Account[] a1=null;
a1=new Account[6];
a1[0]=new Account("20173599","zhoubo","2018-09-20",1,"753951",0,0);
a1[1]=new Account("20173598","zhoubo","2018-09-20",1,"753951",0,0);
a1[2]=new Account("20173597","zhoubo","2018-09-20",1,"753951",0,0);
a1[3]=new Account("20173596","zhoubo","2018-09-20",1,"753951",0,0);
a1[4]=new Account("20173595","zhoubo","2018-09-20",1,"753951",0,0);
File file = null;
FileWriter fw = null;
file = new File("E:\\eclipse-workspace\\信 1705-1班 20173599 周博\\accountinformation.txt");
try {
if (!file.exists()) {
file.createNewFile();
}
fw=new FileWriter(file);
for(int i=0;i<5;i++)
{
fw.write(a1[i].accountID+a1[i].accountname+a1[i].accountpassword+a1[i].accountbalance);
fw.flush();
}
System.out.println("写数据成功!");
}
catch (IOException e) {
e.printStackTrace();
}
finally {
if(fw!=null)
{
try {
fw.close();
}catch (IOException e)
{
e.printStackTrace();
}
}
}
File file1 = null;
FileWriter fw1 = null;
file1 = new File("E:\\eclipse-workspace\\信 1705-1班 20173599 周博\\accountinformation.txt");
try {
if (!file1.exists()) {
file1.createNewFile();
}
fw1=new FileWriter(file1);
for(int i=0;i<5;i++)
{
fw1.write(a1[i].accountID+a1[i].accountname+a1[i].accountpassword+a1[i].accountbalance);
fw1.flush();
}
System.out.println("写数据成功!");
}
catch (IOException e) {
e.printStackTrace();
}
finally {
if(fw1!=null)
{
try {
fw1.close();
}catch (IOException e)
{
e.printStackTrace();
}
}
}
Shuru_zhanghao(a1);
Shuru_mima(a1);
M=2;
if(M==-2)
{
System.out.println("您有三次机会 如果全错将被没收");
for(int i=1;i<=3;i++)
{
Scanner scan=new Scanner(System.in);
String l;
l=scan.next();
if(l!=a1[N].accountpassword)
{
System.out.println("您错了"+i+"次");
if(i==3) {
System.out.println("该账号三次录入密码错误,该卡已被系统没收,请与工行及时联系处理");
break;}
}
else break;
}
}
if(M==2)
{ char ch='y';
while(ch=='y')
{
System.out.println("\t欢迎"+a1[N].accountname+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println("\t1、 存款");
System.out.println("\t2、 取款:");
System.out.println("\t3、 转账汇款:");
System.out.println("\t4、 修改密码:");
System.out.println("\t5、 查询余额:");
System.out.println("\t6、 退出:");
Scanner scan=new Scanner(System.in);/*输入 等待输入*/
int sc5=scan.nextInt();//输入的值
switch(sc5)
{
case 1:
{
Cunkuan(a1);
break;
}
case 2:
{
Cunkuan(a1);
break;
}
case 5:
{
Cha_yu(a1);
}
case 6:
{
break;
}
}
}
}
}
static void Cha_yu(Account [] a)
{
System.out.println("\t当前余额为:");
System.out.println(a[N].accountbalance);
}
static void Qukuan(Account [] a)
{
System.out.println("******************************************************");
System.out.println("\t欢迎zhoubo使用中国银行自助柜员系统");
System.out.println("******************************************************");
System.out.println("\t请输入取款金额:");
Scanner in=new Scanner(System.in);
int O;
O=in.nextInt();
a[N].amount=O;
a[N].accountbalance=a[N].accountbalance-a[N].amount;
System.out.println("\t当前账户存款操作成功");
System.out.println("\t当前余额为:");
System.out.println(a[N].accountbalance);
}
static void Cunkuan(Account [] a)
{
System.out.println("******************************************************");
System.out.println("\t欢迎"+a[N].accountname+"o使用中国银行自助柜员系统");
System.out.println("******************************************************");
System.out.println("\t请输入存款金额:");
Scanner in=new Scanner(System.in);
int O;
O=in.nextInt();
a[N].amount=O;
System.out.println("******************************************************");
System.out.println("\t当前账户存款操作成功");
System.out.println("\t当前余额为:");
a[N].accountbalance+=a[N].amount;
System.out.println(a[N].accountbalance);
}
static void Shuru_zhanghao(Account [] a)
{
System.out.println("******************************************************");
System.out.println("\t欢迎"+a[N].accountname+"使用中国工商银行自动柜员系统");
System.out.println("******************************************************");
System.out.println("\t请输入您的账号:");
Scanner in=new Scanner(System.in);
String O;
O=in.next();
System.out.println("******************************************************");
for(int i=0;i<5;i++)
{
if(O==a[i].accountID)
{
M=1;N=i;
}
else {System.out.println("输入正确!");M=-1;}
}
}
static void Shuru_mima(Account [] a)
{
System.out.println("******************************************************");
System.out.println("\t欢迎"+a[N].accountname+"使用中国银行自助柜员系统");
System.out.println("******************************************************");
System.out.println("\t请输入您的密码:");
Scanner in=new Scanner(System.in);
String O;
O=in.next();
System.out.println("******************************************************");
if(O==a[N].accountpassword)
{
M=2;
}
else {System.out.println("输入正确!");M=-2;}
}
}
简单ATM机功能实现及感想的更多相关文章
- 连接数据库——模拟ATM机查、存、取、开户功能
1.界面:包含开户.查询.存款.取款.功能 package com.bank.test; /** * * @author Administrator *界面类 */ public class Jiem ...
- 简单的小程序实现ATM机操作
简单的小程序实现ATM机操作 代码如下: package Day06; import java.util.Scanner; public class TestAccount { public stat ...
- 模拟ATM机银行系统
淄博汉企Java基础考核项目 模拟银行自助终端系统 一. 本系统模拟银行用户使用ATM机开户.查询.存款.取款功能,要求使用java语言编程实现. 说明: 1. 对于数据输入异常,可使用java异常处 ...
- JAVA - ATM机程序
ATM机程序 UnionPayTest.java package oo.day06.work; public class UnionPayTest { } interface UnionPay{ // ...
- 第一次尝试使用JAVA编写的ATM机程序
package study; import java.util.Scanner; public class ATM { private static int[] users = { 111111, 2 ...
- 练习题:试使用C#编程实现银行、ATM等功能
练习题:试使用编程实现银行.ATM等功能 using System; using System.Collections.Generic; using System.Linq; using System ...
- 简易ATM机
简易ATM机(代码如下): /* * 功能:简易银行系统 */package day8; import java.util.Scanner; /** * * @FengYan Huang Admini ...
- python实现atm机基本操作及购物车
一.需求分析 ATM机要为用户提供转账,提现,还款,付款,消费流水,操作记录等操作接口 ATM机要为管理员提供创建用户,冻结解冻,修改额度的功能 ATM机管理员认证使用装饰器来实现 购物车要提供管理员 ...
- 多用户ATM机(面向对象编程)
let readline = require('readline-sync'); // 清屏函数 let clear = () => process.stdout.write(process.p ...
随机推荐
- Mysql 基准测试mysqlslap,sysbench
基准测试基本步骤 设计尽可能简单,明确测试方式哪一种,使用什么样的数据 例如:反映实际情况,用生产环境的数据的备份,可以通过日志,进行访问量的回放 如果测试性能,可以用测试工具生成数据. 执行一次和 ...
- RTB业务知识之2-Open-RTB全景
一.前言 openrtb是一套开源的竞价广告系统,来自IAB的贡献,非常好.有非常多的值得借鉴的地方,最近基于其所提供sdk api接口文档介绍,整理了相关的资料.主要包括其生态图体系.业务流程和主要 ...
- Eclipse创建一个mybatis工程实现连接数据库查询
Eclipse上创建第一mybatis工程实现数据库查询 步骤: 1.创建一个java工程 2.创建lib文件夹,加入mybatis核心包.依赖包.数据驱动包.并为jar包添加路径 3.创建resou ...
- Ubuntu 14.10 下Hadoop HttpFS 配置
因为hadoop集群中需要配置一个图形化管理数据的截面,后来找到HUE,那么在配置HUE的过程中,发现需要配置httpfs,因为配置了httpfs,hue才能去操作hdfs中的数据. HttpFs能干 ...
- 一次mysql数据关于union+concat用法的记录
SELECT CONCAT('SELECT COUNT(*) FROM ',table_name,' union all') FROM information_schema.tables WHERE ...
- U3D学习08-异步、协程
1.调用 invoke不能传参, 2.协程(不是线程,拥有自己独立的执行序列) Coroutine(尽可能减少计算,提高运行效率) 需要迭代器IEnumerate,迭代器中有返回方法yield 协程的 ...
- spark 2.0.0集群安装与hive on spark配置
1. 环境准备: JDK1.8 hive 2.3.4 hadoop 2.7.3 hbase 1.3.3 scala 2.11.12 mysql5.7 2. 下载spark2.0.0 cd /home/ ...
- hive spark版本对应关系
查看hive source下面的pom.xml,可以找到官方默认发布的hive版本对应的spark版本,在实际部署的时候,最好按照这个版本关系来,这样出现兼容问题的概率相对较小. 下面面列出一部分对应 ...
- jquery事件及插件
jquery事件 方法 描述 bind() 向匹配元素附加一个或更多事件处理器 blur() 触发.或将函数绑定到指定元素的 blur 事件 change() 触发.或将函数绑定到指定元素的 chan ...
- 图片Alpha预乘的作用[转]
Premultiplied Alpha 这个概念做游戏开发的人都不会不知道.Xcode 的工程选项里有一项 Compress PNG Files,会对 PNG 进行 Premultiplied Alp ...