//信1705-3 20173507 周龙海
package account;

public class account {
private String accountID;
private String accountname;
private String operatedate;
private int operatetype;
private String accountpassword;
private int accountbalance;
private int amount;

account ()
{
accountID = "" ;
accountname = "" ;
operatedate = "" ;
operatetype = 0 ;
accountpassword = "" ;
accountbalance =0 ;
amount =0 ;
}

account (String a , String b , String c , int d , String e , int f , int g )
{
accountID = a ;
accountname = b ;
operatedate = c ;
operatetype = d ;
accountpassword = e ;
accountbalance = f ;
amount = g ;
}

//设置accountID的值
public void set_accountID(String str)
{
accountID = str;
}

//获取accountID的值
public String get_accountID()
{
return accountID;
}

//设置accountname的值
public void set_accountname(String str)
{
accountname = str;
}

//获取accountname的值
public String get_accountname()
{
return accountname;
}

//设置operatedate的值
public void set_operatedate(String str)
{
operatedate = str;
}

//获取operatedate的值
public String get_operatedate()
{
return operatedate;
}

//设置operatetype的值
public void set_operatetype(int i)
{
operatetype = i;
}

//获取operatetype的值
public int get_operatetype()
{
return operatetype;
}

//设置accountpassword的值
public void set_accountpassword(String str)
{
accountpassword = str;
}

//获取accountpassword的值
public String get_accountpassword()
{
return accountpassword;
}

//设置accountbalance的值
public void accountbalance(int i)
{
accountbalance = i;
}

//获取accountbalance的值
public int get_accountbalance()
{
return accountbalance;
}

//设置amount的值
public void set_amount(int i)
{
amount = i;
}

//获取amount的值
public int get_amount()
{
return amount;
}

}

//信1705-3 20173507 周龙海
package account;

import java.util.Scanner;
import java.io.*;

import account.account;
public class accountmanager {
private account ai[];
private int number;
//设置数组大小
Scanner scanner = new Scanner(System.in);
String ID;//输入的账号
int A = 0;// 判断对错,0为错
int T = 0;// 正确数
String password;// 密码
accountmanager()
{
number=0;
ai=new account[100];
}

//系统界面1
private static void face()
{
System.out.println("***************************************************");
System.out.println(" 欢迎使用中国工商银行自动柜员系统");
System.out.println("***************************************************");
System.out.println(" 请输入您的账号:");
System.out.println("***************************************************");
}
public static void main(String[] args) throws Exception {

while(true)
{
dang0.jiemiankaishi();
String Id=in.nextLine();
dang1.setAccountID(Id);
dang1.bianbie();
if(dang1.bianbie()==true)
{
dang1.bianbie2();
break;
}
count++;
if(count>2)
{
System.out.println("该账号三次录入错误,该卡已被系统没收,请与工行及时联系处理");
break;
}
}
while(true)
{
dang0.shumima();
String shupassword=in.nextLine();
if(dang1.bianbiemima1(shupassword)==true)
{
String password=dang1.getAccountpassword();
if((password.equals(shupassword)))
break;
}
System.out.println("密码输入错误,请重新输入");
count++;
if(count>2)
{
System.out.println("该账号三次录入密码错误,该卡已被系统没收,请与工行及时联系处理");
break;
}
}
String xuanze1="1";
String xuanze2="2";
String xuanze3="3";
String xuanze4="4";
String xuanze5="5";
String xuanze6="q";
String xuanze;

while(true)
{
dang1.shuzijiemian();
xuanze=in.nextLine();
if((xuanze.equals(xuanze1)))
{
dang1.cunkuan();
int cunkuanshuzhi=in.nextInt();
if(cunkuanshuzhi%100!=0)
{
System.out.println("输入金额有误,返回操作界面");
}
else
{
dang1.cunkuanshezhi(cunkuanshuzhi);
dang1.cunkuanchengongjiemian();
}
}
else if((xuanze.equals(xuanze2)))
{
dang1.qukuanjiemian();
int qukuanxuanxiang=in.nextInt();
switch(qukuanxuanxiang)
{
case 1:
{
dang1.bianbieluru(100);
}break;
case 2:
{
dang1.bianbieluru(500);
}break;
case 3:
{
dang1.bianbieluru(1000);
}break;
case 4:
{
dang1.bianbieluru(1500);
}break;
case 5:
{
dang1.bianbieluru(2000);
}break;
case 6:
{
dang1.bianbieluru(5000);
}break;
case 7:
{
System.out.print("请输入其他金额:");
int luruyue=in.nextInt();
dang1.bianbieluru(luruyue);
}break;
case 8:
{
System.out.println("感谢使用!");
System.exit(0);
}break;
case 9:
{
break;
}
}
}
else if((xuanze.equals(xuanze3)))
{
dang1.zhuanzhangjiemian();
String zhuanzhangzhanghu=in.nextLine();
dang1.zhuanzhangzhanghupanding(zhuanzhangzhanghu);
dang2.bianbie();
if(dang2.bianbie()==true)
{
dang2.bianbie2();
dang1.zhuanzhangjinejiemian();
int zhuanzhangjine=in.nextInt();
if(dang1.zhuanzhangbianbie(zhuanzhangjine, zhuanzhangzhanghu)==true)
dang2.zhnaghu2zenyue(zhuanzhangjine);
}
}
else if((xuanze.equals(xuanze4)))
{
dang1.xiugaimimajiemian();
String shurumima=in.nextLine();
dang1.bianbiemima(shurumima);
dang1.mimacunruwenjian();
dang1.mimachongxinxieru();

}
else if((xuanze.equals(xuanze5)))
{
dang1.chaxungongneng();
}
else if((xuanze.equals(xuanze6)))
{
}
}
}

public boolean bianbie()throws IOException //辨别账户位数
{
if(accountID.length()!=8)
{
System.out.println("该卡不是工行卡");
return false;
}
else
return true;
}
public boolean bianbiemima1(String ps)throws IOException //辨别密码位数
{
if(ps.length()!=6)
{
System.out.println("密码格式错误");
return false;
}
else
return true;
}
public void bianbie2()throws Exception //辨别账户信息
{
String fileContent = readFileContent("D:/accountinformation.txt");
System.out.println(fileContent);
}
private static String readFileContent(String fileName) throws IOException {
File file = new File(fileName);
BufferedReader bf = new BufferedReader(new FileReader(file));
String content = "";
StringBuilder sb = new StringBuilder();
String Idjia1=atmbianliang.getAccountID();
while(content != null){
content = bf.readLine();
if((Idjia1.equals(content)))
{
System.out.println("账户正确");
String zhanghumima=bf.readLine();
accountpassword=zhanghumima;
}
if(content == null){
break;
}
}
bf.close();
System.out.println("识别账户结束");
return sb.toString();
}
public void bianbie001()throws Exception //辨别转账账户
{
String fileContent2 = readFileContent2("D:/accountinformation.txt");
System.out.println(fileContent2);
}
private static String readFileContent2(String fileName) throws IOException {

File file = new File(fileName);

BufferedReader bf = new BufferedReader(new FileReader(file));
String content = "";
StringBuilder sb = new StringBuilder();
String Idjia1=atmbianliang.getAccountID();
while(content != null){
content = bf.readLine();
if((Idjia1.equals(content)))
{
System.out.println("账户正确");
String zhanghumima=bf.readLine();
accountpassword=zhanghumima;
}
if(content == null){
break;
}
}
bf.close();
System.out.println("识别账户结束");
return sb.toString();
}
public void cunkuanshezhi(int a) throws FileNotFoundException
{
accountbalance=accountbalance+a;
cunkuanjilu(a);
}
public void zhuanzhangzhanghupanding(String c)
{
if((c.equals(accountID)))
{
System.out.println("账户不能是自己");
}
else
return;
}
public void bianbieluru(int b)throws FileNotFoundException
{
if(accountbalance>=b)
{
accountbalance=accountbalance-b;
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 当前账户取款"+b+"元操作成功 ");
System.out.println(" 当前账户余额为:"+accountbalance+"元 ");
System.out.println("***************************************************************");
qukuanjilu(b);
}

else
System.out.println("账户余额不足");
}
public void qukuanjilu(int a)throws FileNotFoundException //取款记录写入
{
String filePath = "D:/accountlist.txt";
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
try
{
File file = new File(filePath);
PrintStream qk = new PrintStream(new FileOutputStream(file));
qk.append("操作日期"+df.format(new Date())+"取款 "+a+"元");
}catch(FileNotFoundException e)
{
e.printStackTrace();
}
}
public boolean zhuanzhangbianbie(int a,String b)throws FileNotFoundException
{
if(accountbalance>=a)
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 请确认是否向"+b+"转账"+a+"元 (Y确认转账,N不转账) ");
String zhuanzhangqueren=in.nextLine();
if((zhuanzhangqueren.equals("Y")))
{
accountbalance=accountbalance-a;
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 当前账户向"+b+"成功转账"+a+"元");
System.out.println(" 当前账户余额为"+accountbalance+"元");
System.out.println("***************************************************************");
zhuanzhangjilu(a);
return true;
}
else
{
return false;
}
}
return false;
}
public void zhuanzhangjilu(int a)throws FileNotFoundException
{
String filePath = "D:/accountlist.txt";
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
try
{
File file = new File(filePath);
PrintStream zz = new PrintStream(new FileOutputStream(file));
zz.append("操作日期"+df.format(new Date())+"转账 "+a+"元");
}catch(FileNotFoundException e)
{
e.printStackTrace();
}
}
public void zhnaghu2zenyue(int zz2)
{
accountbalance=accountbalance+zz2;
}
public void bianbiedangqianmima()
{
String dangqianmima=in.nextLine();
if((dangqianmima.equals(accountpassword)))
return;
else
System.out.println("当前密码录入错误");
}
public void bianbiemima(String a)
{
if((a.equals(accountpassword)))
{
String xiugaimima=in.nextLine();
String querenmima=in.nextLine();
if((xiugaimima.equals(querenmima)))
{
accountpassword=querenmima;
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 当前账户密码修改成功 ");
System.out.println("***************************************************************");

}
else
{
System.out.println(" 修改密码与确认密码不一致 ");
return;
}
}
else
{
System.out.println(" 当前密码录入错误 ");
return;
}
}
public void xiugaimimaluru()throws FileNotFoundException
{
String filePath = "D:/accountlist.txt";
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式
try
{
File file = new File(filePath);
PrintStream xmm = new PrintStream(new FileOutputStream(file));
xmm.append("操作日期"+df.format(new Date())+" 修改密码");
}catch(FileNotFoundException e)
{
e.printStackTrace();
}
}
public void mimacunruwenjian()throws Exception //将文件中的数据写出
{
String fileContent3 = readFileContent3("D:/accountinformation.txt");
System.out.println(fileContent3);
}
private static String readFileContent3(String fileName) throws IOException {
File file = new File(fileName);
BufferedReader bf = new BufferedReader(new FileReader(file));
StringBuilder sb = new StringBuilder();
int zzi=0;
while(zzi<6) {
content2[zzi] = bf.readLine();
zzi++;

}
bf.close();
return sb.toString();
}
public void mimachongxinxieru() throws FileNotFoundException //再将密码写入文件
{
int i=0;
String filePath = "D:/accountinformation.txt";
try
{
File file = new File(filePath);
PrintStream ps = new PrintStream(new FileOutputStream(file));
while(i<6)
{

ps.println(content2[i]);
if((content2[i].equals(accountID)))
ps.println(accountpassword);
i++;
}

}catch(FileNotFoundException e)
{
e.printStackTrace();
}
}
public void cunkuanjilu(int a)throws FileNotFoundException //存款记录记录
{
String filePath = "D:/accountlist.txt";
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//设置日期格式

try
{
File file = new File(filePath);
PrintStream ck = new PrintStream(new FileOutputStream(file));
ck.append("操作日期"+df.format(new Date())+"存款 "+a+"元");
}catch(FileNotFoundException e)
{
e.printStackTrace();
}

}
public void cunkuan() //存款界面
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 请输入存款金额; ");
System.out.println("***************************************************************");
}
public void shuzijiemian()
{
System.out.println("***************************************************************");
System.out.print(" 欢迎");
System.out.print(accountID);
System.out.println("使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 1.存款 ");
System.out.println(" 2.取款 ");
System.out.println(" 3.转账汇款 ");
System.out.println(" 4.修改密码 ");
System.out.println(" 5.查询余额 ");
System.out.println("***************************************************************");
}
public void cunkuanchengongjiemian()
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 当前账户存款操作成功 ");
System.out.println(" 当前账户余额为:"+accountbalance+"元 ");
System.out.println("***************************************************************");
}
public void qukuanjiemian()
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 当前账户每日可以支取2万元 ");
System.out.println(" 1、100元 ");
System.out.println(" 2、500元 ");
System.out.println(" 3、1000元 ");
System.out.println(" 4、1500元 ");
System.out.println(" 5、2000元 ");
System.out.println(" 6、5000元 ");
System.out.println(" 7、其他金额 ");
System.out.println(" 8、退卡 ");
System.out.println(" 9、返回 ");
System.out.println("***************************************************************");
}
public void zhuanzhangjiemian()
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 请输入转账账户 ");
System.out.println("***************************************************************");
}
public void zhuanzhangjinejiemian()
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 请输入转账金额 ");
System.out.println("***************************************************************");
}
public void xiugaimimajiemian()
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 请输入当前密码: ");
System.out.println(" 请输入修改密码: ");
System.out.println(" 请输入确认密码: ");
System.out.println("***************************************************************");
}
public void chaxungongneng()
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 当前账户余额为:"+accountbalance+"元 ");
System.out.println(" 账户清单信息为: ");
System.out.println("***************************************************************");
}

}

//信1705-3 20173507 周龙海
package account;

import java.util.Scanner;
public class main {
public static void main(String[] args)
{
Scanner input=new Scanner(System.in);
account app;
String str1,str2;
accountmanager m=new accountmanager();
face1();
str1 = input.next();
face2();
str2 = input.next();
yue();

}

private static void face1()
{
System.out.println("***************************************************");
System.out.println(" 欢迎使用中国工商银行自动柜员系统");
System.out.println("***************************************************");
System.out.println(" 请输入您的账号:");
System.out.println("***************************************************");
}

private static void face2()
{
System.out.println("***************************************************");
System.out.println(" 欢迎使用中国工商银行自动柜员系统");
System.out.println("***************************************************");
System.out.println(" 请输入您的密码:");
System.out.println("***************************************************");
}

public static void yue()
{
System.out.println("***************************************************************");
System.out.println(" 欢迎"+accountID+"使用中国工商银行自助柜员系统 ");
System.out.println("***************************************************************");
System.out.println(" 当前账户存款操作成功。 ");
System.out.print(" 当前账户余额为:");
System.out.print(accountbalance);
System.out.print("元");
System.out.println("***************************************************************");

}

}

课堂测试代码(未完全实现,部分代码有bug,仅供参考)的更多相关文章

  1. Blazor WebAssembly 船新项目下载量测试 , 仅供参考.

    前言: 昨天 Blazor WebAssembly 3.2 正式发布了.  更新 VS2019后就能直接使用. 新建了两个PWA项目,  一个不用asp.net core (静态部署), 一个使用as ...

  2. 微信JSSDK javascript 开发 代码片段,仅供参考

    最全面最专业的微信公众平台开发教程:http://www.cnblogs.com/txw1958/p/weixin-js-sdk-demo.html 比较完整的分享教程:http://www.cnbl ...

  3. Webdriver控制翻页控件,并实现向前向后翻页功能,附上代码,仅供参考,其他类似日期控件的功能可以自己封装

    新增输入与选择页面的html源码: <div style="margin-top:-60px;" class="modal-content" id=&qu ...

  4. python读取ini配置文件的示例代码(仅供参考)

    这篇文章主要介绍了python读取ini配置文件过程示范,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下 安装 pip install configp ...

  5. 疫情在校学生之——用python对某校园热水服务app进行测试,实现自动免费用水(仅供参考)

    写在前面的过场话: 本文只是对某校园热水服务app做个测试,其实本人并没有做大坏事,并未传播相关技术,文章以下内容的敏感部分会打码,并且相关厂商已经正在进行漏洞修复,大家看看就好.文章后会提供&quo ...

  6. AC与AP的安装使用(未经实战,仅供参考,未完待续)

    AC:无线控制器(Wireless Access Point Controller) AP:无线访问接入点(WirelessAccessPoint) 以信锐AC为例 AC设备的管理口为MANAGE(E ...

  7. # 课堂测试(CH6)20155218

    课堂测试(CH6) 1. 下面代码中,对数组x填充后,采用直接映射高速缓存,所有对x和y引用的命中率为(D) A . 1 B . 1/4 C . 1/2 D . 3/4 解析:在x[0],y[0]时发 ...

  8. 20155222卢梓杰 课堂测试ch06补做

    20155222卢梓杰 课堂测试ch06补做 1.下面代码中,对数组x填充后,采用直接映射高速缓存,所有对x和y引用的命中率为() A . 1 B . 1/4 C . 1/2 D . 3/4 正确答案 ...

  9. 2015539平措卓玛课堂测试(ch06)

    课堂测试(ch06) 1.下面代码中,对数组x填充后,采用直接映射高速缓存,所有对x和y引用的命中率为(D) A .1 B .1/4 C .1/2 D .3/4 解析:缓存命中:当程序需要第(k+1) ...

随机推荐

  1. 搭建nginx服务器,虚拟主机,反向代理

    1 搭建Nginx服务器 1.1 问题 在IP地址为192.168.10. 5的主机上安装部署Nginx服务,并可以将Nginx服务器升级到更高版本,要求编译时启用如下功能: SSL加密功能 查看服务 ...

  2. 20165236 2017-2018-2 《Java程序设计》第九周学习总结

    20165236 2017-2018-2 <Java程序设计>第九周学习总结 一.第十三章教材内容总结 1.URL类 URL类是java.net包中的一个重要的类,使用URL创建对象的应用 ...

  3. kickstart模式实现批量安装centos7.x系统

    1.1 安装系统的方法 l  光盘(ISO文件,光盘的镜像文件)===>>每一台物理机都得给一个光驱,如果用外置光驱的话,是不是每台机器都需要插一下 l  U盘:ISO镜像刻录到U盘==& ...

  4. Centos7限速和测速

    限速 wondershaper是国外人开发的一款在Linux内核下基于TC工具的对整块网卡的限度工具. 第一种安装方法 首先下载wondershaper的rpm安装包:wondershaper-1.1 ...

  5. 遇到问题---hosts不起作用问题的解决方法

    c:\WINDOWS\system32\drivers\etc\hosts 文件的作用是添加 域名解析 定向 比如添加 127.0.0.1  www.baidu.com 那我们访问www.baidu. ...

  6. python package

    简要说一下,一个python模块就是一个python文件:一个包就是存放python模块的目录结构,并且包下边必须要有一个可以为空的__init__.py模块 //test.py from mypac ...

  7. Bootstrap-全局样式的文本颜色和背景颜色

    .text-五种颜色   文本颜色.text-info文本浅蓝颜色-提示.text-warning文本黄色-警告颜色.text-success文本绿色-成功颜色.text-primary文本深蓝色-警 ...

  8. SQL 跟据出生日期求年龄

    最近做项目时遇到一个问题. 跟据人员的生日与当前日期进行比较求出该人员实际年龄.这个看上去比较简单的问题,其实不细心去看也会有很多问题. 先看第一种: 一张人员信息表里有一人生日(Birthday)列 ...

  9. Python杨辉三角

    杨辉三角,是二项式系数在三角形中的一种几何排列,在中国南宋数学家杨辉1261年所著的<详解九章算法>一书中出现.在欧洲,帕斯卡(1623----1662)在1654年发现这一规律,所以这个 ...

  10. 4.构造Thread对象你也许不知道的几件事

    1.Thread类对象只有在调用了start()方法之后,JVM虚拟机才会给我们创建一个真正的线程!否则就不能说是创建了线程!也就是说new Thread()之后,此时实际上在计算机底层,操作系统实际 ...