//信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. COFF,amd64.vc90.mfc两个布署的问题

    今天解决了两个bug (1)一个是COFF文件损坏,因为装了vs2010和vs2013,搜索C:\Program Files(x86)文件夹下的cvtres.exe.出现了VC10和VC12的4个,x ...

  2. spring框架中的注解

  3. Spark中repartition和partitionBy的区别

    repartition 和 partitionBy 都是对数据进行重新分区,默认都是使用 HashPartitioner,区别在于partitionBy 只能用于 PairRDD,但是当它们同时都用于 ...

  4. python 根据字符串动态的生成变量名并且赋值

    Python 动态的创建变量 一.子符串的形式 这是在今天的一个项目中,发现需要动态的创建很多变量.每个变量对应的值的来源都相同.在网上看了些资料,研究出了这个动态创建变量的牛逼方法. 所用的方法就是 ...

  5. 【LeetCode每天一题】Permutations(排列组合)

    Given a collection of distinct integers, return all possible permutations. Example: Input: [1,2,3] O ...

  6. 【LeetCode每天一题】Trapping Rain Water(获得雨水的容量)

    Given n non-negative integers representing an elevation map where the width of each bar is 1, comput ...

  7. 5.C#释放非托管资源1

    释放非托管资源 在介绍释放非托管资源的时候,我觉得有必要先来认识一下啥叫非托管资源,既然有非托管资源,肯定有托管资源. 托管资源指的是.net可以自棕进行回收的资源,主要是指托管堆上分配的内存资源.托 ...

  8. LeetCode108.将有序数组转换为二叉搜索树

    将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树. 本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1. 示例: 给定有序数组: [-10,-3,0, ...

  9. c#之如何正确地实现IDisposable接口

    见实例: public class TestClass : IDisposable { //供程序员显式调用的Dispose方法 public void Dispose() { //调用带参数的Dis ...

  10. Eclipse修改编码方式

    1.修改工作空间默认编码 1.修改工作空间默认编码:window -> preferences ->  General -> Workspace 2.修改文件的编码 在Eclipse ...