---恢复内容开始---

package ATM;
 

//信1705-2 20173568 李泽宇
 
import java.util.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
 
import java.io.IOException;
 
public class Account {
 
 public static List<Account> accountlist=new LinkedList<Account>();
 private String accountID;
 private String accountname;
 private String operatedate;
 private int operatetype;
 private String accountpassword;
 private int accountbalance;
 private int amount;
public Account() {};
public  Account(String accountID,String accountname,String operatedate,int operatetype,String accountpassword,int accountbalance) {
    this.accountID=accountID;
    this.accountname=accountname;
    this.operatedate=operatedate;
    this.operatetype=operatetype;
    this.accountpassword=accountpassword;
    this.accountbalance=accountbalance;
}
public Account(String accountID,String accountname,String accountpassword,int accountbalance) {
    this.accountID=accountID;
    this.accountname=accountname;
    this.accountpassword=accountpassword;
    this.accountbalance=accountbalance;
}
public Account(String accountID,String accountname,String operatedate,int operatetype,int amount) {
    this.accountID=accountID;
    this.accountname=accountname;
    this.operatedate=operatedate;
    this.operatetype=operatetype;
    this.amount=amount;
}
public  String get_accountID() {
    return accountID;
}
public String get_accountname() {
    return accountname;
}
public String get_operatedate() {
    return operatedate;
}
public int get_operatetype() {
    return operatetype;
}
public String get_accountpassword() {
    return accountpassword;
}
public int get_accountbalance() {
    return accountbalance;
}
public int get_amount() {
    return amount;
}
public void set_accountID(String accountID) {
    this.accountID=accountID;
}
public void set_accountname(String accountname) {
    this.accountname=accountname;
}
public void set_operatedate(String operatedate) {
    this.operatedate=operatedate;
}
public void set_operatetype(int type) {
    this.operatetype=type;
}
public void set_accountpassword(String password) {
    this.accountpassword=password;
}
public void set_accountbalance(int balance) {
    this.accountbalance=balance;
}
public void set_amount(int amount) {
    this.amount=amount;
}
public  static void  addaccount (String accountID,String accountname,String accountpassword,int accountbalance) {
     accountlist.add(new Account(accountID,accountname,accountpassword,accountbalance));
}
public static void file_in() {
File file0 = new File("F:/eclipse/ATM", "accountinformation.txt");
addaccount("20173450","zhangqiang","000001",900);//创建第一个账户并放入list中
addaccount("20173451","zhanghao","000002",1000);//创建第二个账户
addaccount("20173452","sunyang","000003",700);//创建第三个账户
addaccount("20173453","lihao","000004",1200);//创建第四个账户
addaccount("20173454","liulei","000005",8500);//创建第五个账户//创建文件对象
try {
    if (!file0.exists()) {               //如果文件不存在则新建文件
        file0.createNewFile();          
 
    }
    FileOutputStream output = new FileOutputStream(file0);
    for(int j=0;j<accountlist.size();j++) {
        byte[] bytes0 =accountlist.get(j).accountID.getBytes();
        byte[] bytes1 =accountlist.get(j).accountname.getBytes();
        byte[] bytes2 =accountlist.get(j).accountpassword.getBytes();
    output.write(bytes0);
    output.write(bytes1);
    output.write(bytes2);
    output.write(accountlist.get(j).accountbalance);
    }
    output.close();
            }catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
在一个类中建成的文件,先把之前做的扒了过来,后面会在寒假完善

---恢复内容结束---

最新文章

  1. Android Volley
  2. 《jQuery知识点总结》(二)
  3. Javascript自己动手实现getter/setter
  4. App Transport Security has blocked a cleartext
  5. Eclipse自动补全功能和自动生成作者、日期注释等功能设置
  6. android view生命周期
  7. 让浏览器进行跨域访问, 开发阶段需要跨域访问的测试方案 chrome的快捷方式里面 加 &quot;C:\Program Files (x86)\Google\Chrome\Application\chrome.exe&quot; --args --disable-web-security
  8. Linux系统备份与还原
  9. Android系统进程间通信Binder机制在应用程序框架层的Java接口源代码分析
  10. android listview Caused by: java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
  11. LVS-NAT搭建HTTP及HTTPS
  12. python logging一个通用的使用模板
  13. QT中的相对位置,绝对位置之间的转换(maptoglobal,mapfromglobal)
  14. 【12】Django 中间件
  15. PS制作简洁漂亮的立体抽丝文字
  16. Redis详解与常见问题解决方案
  17. 10元买啤酒问题Java解法
  18. BZOJ2512 : Groc
  19. Salesforce的报表和仪表板
  20. vue-底部导航栏

热门文章

  1. RAC环境修改数据库字符集
  2. POJ 2155 Matrix【二维树状数组+YY(区间计数)】
  3. Nmap的基础知识
  4. Gulp 方法
  5. maven学习记录一——maven介绍及入门
  6. HTML5之转动的轮子
  7. 【题解】洛谷P2421[NOI2002]荒岛野人 (Exgcd)
  8. 【Linux-CentOS】【转-更正】使用CentOS DVD1 和DVD2做本地yum源
  9. AngularJS web应用程序
  10. Python基础—14-邮件与短信