测验报告

Posted on 2018-09-24 22:37  咳咳你  阅读(82)  评论(0编辑  收藏  举报

     在20号的java测试后,自己内心百感交集,自己对自己的知识盲区有了非常大的认识。也深刻感觉到了老师说得那样,自己到底离真正的技术人员还差了多少。就自己现在的技术,连一些小型的程序都完成不了。

     在测试之前,自己也感觉到了应该写不出来。老师在放暑假之前就开了紧急会议,也说了在假期要自己学习java知识,说实话自己也没当回事。虽然说看了一些java的书,但其实就是自欺欺人。根本没有投入自己的心去好好学习。对于java的一些专业知识自己也两眼一抹黑。在测试之前,自己只能临阵磨枪学习一些基础的java知识。当然对于老师提的问题程序,老师因为仁慈所以选择给了一些基础分。因为自己之前学习了一些java的知识,所以这些基础分自己还是有信心去拿到的。并且之前老师也给了一个题目,对于那个题目因为想及格,早就研究很多遍了,也查了 电脑。对于那个题目的一些核心程序也记得差不多,老师在课上临时给我们起了一个题目,与那个很相似。我就先把一些能拿到的分数先拿到手,对于一些核心的程序自己在上网查询,然后进行自己的修改。虽然最后程序运行不了,但是在别人的程序中真的得到了很多。也是因为老师还没开课的原因,很多知识自己也不知道。完成那些基础的程序后,我也如愿的得到了及格分。

package ATM;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.util.StringTokenizer;
import java.io.IOException;
import java.text.SimpleDateFormat;   
import java.util.Date;   
public class Account {
	String accountID;
	String accountname;
	String operatedate;    
	int operatetype;
	String accountpassword;。
	int accountbalance;
	int amount;
	public Account() {
		accountID="20173575";
		accountname="WOSHINPC";
		operatedate="2017-9-23";
		operatetype=0;
		accountpassword="201735";
		accountbalance=0;
		amount=0;
	}
	public Account(String accountID, String accountname, String operatedate, int operatetype, String accountpassword,
			int accountbalance, int amount) {
		this.accountID = accountID;
		this.accountname = accountname;
		this.operatedate = operatedate;
		this.operatetype = operatetype;
		this.accountpassword = accountpassword;
		this.accountbalance = accountbalance;
		this.amount = amount;
	}

	
	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) {
		super();
		this.accountID = accountID;
		this.accountname = accountname;
		this.operatedate = operatedate;
		this.operatetype = operatetype;
		this.amount = amount;
	}
	public String getAccountID() {
		return accountID;
	}
	public void setAccountID(String accountID) {
		this.accountID = accountID;
	}
	public String getAccountname() {
		return accountname;
	}
	public void setAccountname(String accountname) {
		this.accountname = accountname;
	}
	public String getOperatedate() {
        long timemillis = System.currentTimeMillis(); 
	     SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");   
	     operatedate=df.format(new Date(timemillis));   
		return operatedate;
	}
	public void setOperatedate(String operatedate) {
		this.operatedate = operatedate;
	}
	public int getOperatetype() {
		return operatetype;
	}
	public void setOperatetype(int operatetype) {
		this.operatetype = operatetype;
	}
	public String getAccountpassword() {
		return accountpassword;
	}
	public void setAccountpassword(String accountpassword) {
		this.accountpassword = accountpassword;
	}
	public int getAccountbalance() {
		return accountbalance;
	}
	public void setAccountbalance(int accountbalance) {
		this.accountbalance = accountbalance;
	}
	public int getAmount() {
		return amount;
	}
	public void setAmount(int amount) {
		this.amount = amount;
	}
	public void writeAccount(PrintWriter out){
	out.println(getAccountID()+"|"+getAccountname() +"|"+getAccountpassword()+"|"+getAccountbalance());	
	}
	public void readAccount(BufferedReader in)throws IOException{
		String ss=in.readLine();
		StringTokenizer St=new StringTokenizer(ss,"|");
		accountID=St.nextToken();
		accountname=St.nextToken();
		accountpassword=St.nextToken();
		accountbalance=Integer.parseInt(St.nextToken());
	}
	public void write1Account(PrintWriter out){
	out.println(getAccountID()+"|"+getAccountname() +"|"+getOperatedate()+"|"+getOperatetype()+"|"+getAmount());	
	}
	public void read1Account(BufferedReader in)throws IOException{
		String ss=in.readLine();
		StringTokenizer St=new StringTokenizer(ss,"|");
		accountID=St.nextToken();
		accountname=St.nextToken();
		operatedate=St.nextToken();
		operatetype=Integer.parseInt(St.nextToken());
		amount=Integer.parseInt(St.nextToken());
	}
}
package ATM模拟;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.PrintWriter;
import java.io.FileWriter;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.io.File;
import java.io.FileNotFoundException;
public class AccountManager {
	private Account[] a1 = new Account[5];
	private String Infor = "accountinformation.txt";
	private String List = "accountlist.txt";
	private String Today = "2018-9-20";
public void login()throws IOException{
	System.out.println("***************************************************************");
	System.out.println("              欢迎使用中国工商银行自动柜员系统");
	System.out.println("***************************************************************");
	System.out.println("                    请输入您的账号:");
	Scanner sc = new Scanner(System.in);
	int a= 5;
	String b = sc.next();
	while(a>3){
		for(int i=0;i<5;i++){
			if(a1[i].getAccountID().equals(b))
			{a=i;break;
			}
			
			if(a==5){
				System.out.println(" 该卡不是工行卡!");
				login();
			}
			else{
				aword(a);
			}
		}
	}
}
public void aword(int a)throws IOException{
	System.out.println("***************************************************************");
	System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
	System.out.println("***************************************************************");
	System.out.println("                    请输入您的密码:");
	  int time= 0;
	  Scanner sc = new Scanner (System.in);
	          while(time<3){
		              String saving = sc.nextLine();
		              if(a1[a].getAccountpassword().equals(sc))
		                   System.out.println("密码录入错误");
		               else
		                  break;
		               time++;
		           }
		           if(time==3)
		        	   login();
		           else
		        	   serviceAll(a);
		      }
public void serviceAll(int a)throws IOException{
    System.out.println("***************************************************************");
        System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
        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("****************************************************************");
        System.out.println("                      请输入:");
        Scanner sc = new Scanner (System.in);
        int temp = sc.nextInt();
              switch(temp)
                 {
                case 1:a1[a].setOperatetype(1);writefile();deposit(a);break;
                 case 2:a1[a].setOperatetype(2);writefile();draw(a);break;
                 case 3:a1[a].setOperatetype(3);writefile();zhuan(a);break;
                 case 4:a1[a].setOperatetype(4);writefile();xiugai(a);break;
                 case 5:a1[a].setOperatetype(5);writefile();yu(a);break;
                 default:serviceAll(a);break;
                 }    
}
public void deposit(int a)throws IOException{
    System.out.println("***************************************************************");
    System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
    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("                 请输入存款金额;");
    Scanner sc = new Scanner (System.in);
    if(sc.hasNext("q"))
    	login();
    else{
    	int JinE = sc.nextInt();//记录金额
    	             if(JinE<=0)
    	             {
    	                 System.out.println(" 输入金额有误");
    	                 deposit(a);
    	             }
    	             else
    	             {
    	                 a1[a].setAmount(a1[a].getAmount()+JinE);
    	                 a1[a].setAccountbalance(a1[a].getAccountbalance()+JinE);
    	                 //-----------------------[数据载入文档]
    	                 System.out.println("***************************************************************");
    	                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
    	                 System.out.println("****************************************************************");
    	                 System.out.println("                当前账户存款操作成功。");
    	                 System.out.println("             当前账户余额为:"+a1[a].getAccountbalance()+"元");

    	                 Scanner scs = new Scanner (new FileReader(List));
    	                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
    	                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
    	                 {
    	                     pws.println(scs.nextLine());
    	                 }
    	                 pws.println(scs.nextLine());
    	                 pws.close();
    	                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
    	                 PrintWriter pw = new PrintWriter (new FileWriter(List));
    	                 pw.print(a1[a].getAccountID());
    	                 pw.print(" ");
    	                 pw.print(Today);
    	                 a1[a].setOperatedate(Today);
    	                 pw.print(" ");
    	                 pw.print("SaveMoney");
    	                 pw.print(" ");
    	                 pw.println(JinE);
    	                 while(!scp.hasNext("ENDOFTHISFILE"))
    	                 {
    	                     pw.println(scp.nextLine());
    	                 }
    	                 pw.println(scp.nextLine());
    	                pw.close();
    	                 writefile();
    	                //----------------------------------------
    	                 serviceAll(a);
    	             }
    	         }        

    	
    	
    }
public void draw(int a)throws IOException{
		System.out.println("***************************************************************");

		System.out.println("欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统:");

		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("***************************************************************:");
		Scanner sc = new Scanner (System.in);
		int q = sc.nextInt();
		switch(q){
		         case 1:
		         {
		             if(a1[a].getAccountbalance()<100)
		             {
		                 System.out.println("账户余额不足");
		                 deposit(a);
		             }
		             else
		             {
		                 a1[a].setAmount(a1[a].getAmount()+100);
		                 a1[a].setAccountbalance(a1[a].getAccountbalance()-100);
		                 System.out.println("***************************************************************");
		                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
		                 System.out.println("****************************************************************");
		                 System.out.println("             当前账户取款操作100元成功。");
		                 System.out.println("             当前账户余额为:"+a1[a].getAccountbalance()+"元");
		                //----------------------------------------------------<以下为文件更新阶段
		                 Scanner scs = new Scanner (new FileReader(List));
		                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
		                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
		                 {
		                     pws.println(scs.nextLine());
		                 }
		                 pws.println(scs.nextLine());
		                 pws.close();
		                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
		                 PrintWriter pw = new PrintWriter (new FileWriter(List));
		                 pw.print(a1[a].getAccountID());
		                 pw.print(" ");
		                 pw.print(Today);
		                 a1[a].setOperatedate(Today);
		                 pw.print(" ");
		                 pw.print("GetMoney");
		                 pw.print(" ");
		                 pw.println(100);
		                 while(!scp.hasNext("ENDOFTHISFILE"))
		                 {
		                     pw.println(scp.nextLine());
		                 }
		                pw.println(scp.nextLine());
		                pw.close();
		                writefile();
		                serviceAll(a);
		             }
		             break;
		        }
		         case 2:
		         {
		             if(a1[a].getAccountbalance()<500)
		             {
		                 System.out.println("账户余额不足");
		                 deposit(a);
		            }
		             else
		             {
		                 a1[a].setAmount(a1[a].getAmount()+500);
		                 a1[a].setAccountbalance(a1[a].getAccountbalance()-500);
		                 System.out.println("***************************************************************");
		                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
		                 System.out.println("****************************************************************");
		                 System.out.println("             当前账户取款操作500元成功。");
		                 System.out.println("             当前账户余额为:"+a1[a].getAccountbalance()+"元");
		                 //----------------------------------------------------<以下为文件更新阶段
		                 Scanner scs = new Scanner (new FileReader(List));
		                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
		                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
		                 {
		                     pws.println(scs.nextLine());
		                 }
		                 pws.println(scs.nextLine());
		                 pws.close();
		                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
		                 PrintWriter pw = new PrintWriter (new FileWriter(List));
		                 pw.print(a1[a].getAccountID());
		                 pw.print(" ");
		                 pw.print(Today);
		                 a1[a].setOperatedate(Today);
		                 pw.print(" ");
		                 pw.print("GetMoney");
		                 pw.print(" ");
		                 pw.println(500);
		                 while(!scp.hasNext("ENDOFTHISFILE"))
		                 {
		                     pw.println(scp.nextLine());
		                 }
		                 pw.println(scp.nextLine());
		                 pw.close();
		                 writefile();
		                 //-----------------------------------
		                 serviceAll(a);
		             }
		             break;
		         }
		         case 3:
		         {
		             if(a1[a].getAccountbalance()<1000)
		             {
		                 System.out.println("账户余额不足");
		                 draw(a);
	             }
		             else
		             {
		                 a1[a].setAmount(a1[a].getAmount()+1000);
		                 a1[a].setAccountbalance(a1[a].getAccountbalance()-1000);
		                 System.out.println("***************************************************************");
		                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
		                 System.out.println("****************************************************************");
		                 System.out.println("             当前账户取款操作1000元成功。");
		                 System.out.println("             当前账户余额为:"+a1[a].getAccountbalance()+"元");
		                 Scanner scs = new Scanner (new FileReader(List));
		                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
		                 while(!scs.hasNext("ENDOFTHISFILE"))
		                 {
		                     pws.println(scs.nextLine());
		                 }
		                 pws.println(scs.nextLine());
		                 pws.close();
		                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
		                 PrintWriter pw = new PrintWriter (new FileWriter(List));
		                 pw.print(a1[a].getAccountID());
		                 pw.print(" ");
		                 pw.print("GetMoney");
		                 pw.print(" ");
		                 pw.println(1000);
		                 while(!scp.hasNext("ENDOFTHISFILE"))
		                 {
		                     pw.println(scp.nextLine());
		                 }
		                 pw.println(scp.nextLine());
		                pw.close();
		                 //-----------------------------------
		                 serviceAll(a);
		             }
		             break;
		         }
		         case 4:
		         {
		             if(a1[a].getAccountbalance()<1500)
		             {
		                 System.out.println("账户余额不足");
		                 draw(a);
		             }
		             else
		             {
		                 a1[a].setAmount(a1[a].getAmount()+1500);
		                 a1[a].setAccountbalance(a1[a].getAccountbalance()-1500);
		                 System.out.println("***************************************************************");
		                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
		                System.out.println("****************************************************************");
		                 System.out.println("             当前账户取款操作1500元成功。");
		                 System.out.println("             当前账户余额为:"+a1[a].getAccountbalance()+"元");
		                 //----------------------------------------------------<以下为文件更新阶段
		                 Scanner scs = new Scanner (new FileReader(List));
		                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
	                while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
		                 {
		                     pws.println(scs.nextLine());
		                 }
		                 pws.println(scs.nextLine());
		                 pws.close();
		                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
		                 PrintWriter pw = new PrintWriter (new FileWriter(List));
		                pw.print(a1[a].getAccountID());
		                 pw.print(" ");
		                 pw.print(Today);
		                 a1[a].setOperatedate(Today);
	                 pw.print(" ");
		                writefile();
		                 pw.print("GetMoney");
		                 pw.print(" ");
		                 pw.println(1500);
		                 while(!scp.hasNext("ENDOFTHISFILE"))
		                 {
		                     pw.println(scp.nextLine());
		                 }
		                 pw.println(scp.nextLine());
		                 pw.close();
		                 //-----------------------------------
		                 serviceAll(a);
		             }
		             break;
		         }
		         case 5:
		         {
		             if(a1[a].getAccountbalance()<2000)
		             {
		                 System.out.println("账户余额不足");
		                 draw(a);
		             }
		             else
		             {
		                 a1[a].setAmount(a1[a].getAmount()+2000);
		                 a1[a].setAccountbalance(a1[a].getAccountbalance()-2000);
		                 System.out.println("***************************************************************");
		                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
		                 System.out.println("****************************************************************");
		                 System.out.println("             当前账户取款操作2000元成功。");
		                 System.out.println("             当前账户余额为:"+a1[a].getAccountbalance()+"元");
		                 //----------------------------------------------------<以下为文件更新阶段
		                 Scanner scs = new Scanner (new FileReader(List));
		                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
		                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
		                 {
		                     pws.println(scs.nextLine());
		                 }
		                 pws.println(scs.nextLine());
		                 pws.close();
		                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
		                 PrintWriter pw = new PrintWriter (new FileWriter(List));
		                 pw.print(a1[a].getAccountID());
		                 pw.print(" ");
		                 pw.print(Today);
		                 a1[a].setOperatedate(Today);
		                 pw.print(" ");
		                 writefile();
		                 pw.print("GetMoney");
		                 pw.print(" ");
		                 pw.println(2000);
		                 while(!scp.hasNext("ENDOFTHISFILE"))
		                 {
		                     pw.println(scp.nextLine());
		                }
		                 pw.println(scp.nextLine());
		                 pw.close();
		                 //-----------------------------------
		                 serviceAll(a);
		             }
		             break;
		         }
		         case 6:
		         {
		             if(a1[a].getAccountbalance()<5000)
		             {
		                 System.out.println("账户余额不足");
		                 draw(a);
		             }
		             else
		             {
		                 a1[a].setAmount(a1[a].getAmount()+5000);
		                 a1[a].setAccountbalance(a1[a].getAccountbalance()-5000);
		                 System.out.println("***************************************************************");
		                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
		                 System.out.println("****************************************************************");
		                 System.out.println("             当前账户取款操作5000元成功。");
		                 System.out.println("             当前账户余额为:"+a1[a].getAccountbalance()+"元");
		                 //----------------------------------------------------<以下为文件更新阶段
		                 Scanner scs = new Scanner (new FileReader(List));
		                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
		                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
		                 {
		                     pws.println(scs.nextLine());
		                 }
		                 pws.println(scs.nextLine());
		                 pws.close();
		                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
		                 PrintWriter pw = new PrintWriter (new FileWriter(List));
		                 pw.print(a1[a].getAccountID());
		                 pw.print(" ");
		                 pw.print(Today);
		                 a1[a].setOperatedate(Today);
		                 pw.print(" ");
		                 writefile();
		                 pw.print("GetMoney");
		                 pw.print(" ");
		                 pw.println(5000);
		                 while(!scp.hasNext("ENDOFTHISFILE"))
		                 {
		                     pw.println(scp.nextLine());
		                 }
		                 pw.println(scp.nextLine());
		                 pw.close();
		                 //-----------------------------------
		                 serviceAll(a);
		             }
		             break;
		         }
		         case 7:
		         {
		             System.out.println("***************************************************************");
		             System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
		             System.out.println("****************************************************************");
		             System.out.println("                请输入取款金额:");
		             int num = sc.nextInt();
	            if(a1[a].getAccountbalance()<num)
		             {
		                 System.out.println("账户余额不足");
		                 draw(a);
		             }
		            else
		             {
		                 a1[a].setAmount(a1[a].getAmount()+num);
		                 a1[a].setAccountbalance(a1[a].getAccountbalance()-num);
		                 System.out.println("***************************************************************");
		                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
		                 System.out.println("****************************************************************");
		                 System.out.println("             当前账户取款操作"+num+"元成功。");
		                 System.out.println("             当前账户余额为:"+a1[a].getAccountbalance()+"元");
		                 writefile();
		                 //----------------------------------------------------<以下为文件更新阶段
		                 Scanner scs = new Scanner (new FileReader(List));
		                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
		                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
		                 {
		                     pws.println(scs.nextLine());
		                 }
		                pws.println(scs.nextLine());
		                pws.close();
		                Scanner scp = new Scanner (new FileReader("files/LinShi"));
		                 PrintWriter pw = new PrintWriter (new FileWriter(List));
		                 pw.print(a1[a].getAccountID());
		                 pw.print(" ");
		                 pw.print(Today);
		                 a1[a].setOperatedate(Today);
		                 pw.print(" ");
		                writefile();
		                 pw.print("GetMoney");
		                 pw.print(" ");
		                 pw.println(num);
		                 while(!scp.hasNext("ENDOFTHISFILE"))
		                 {
		                     pw.println(scp.nextLine());
		                 }
		                 pw.println(scp.nextLine());
		                 pw.close();
		                 serviceAll(a);
		             }
		             break;
		         }
		         case 8:
		         {
		             login();
		             break;
		         }
		         case 9:
		         {
		            serviceAll(a);
		             break;
		         }
		         default:draw(a);break;
		         }
		     }
public void zhuan(int a)throws IOException{
	 System.out.println("***************************************************************");
	          System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
	          System.out.println("***************************************************************");
	          System.out.println("                     请输入转账账户;");
	          Scanner sc = new Scanner (System.in);
	          if(sc.hasNext("q"))
	              login();
	          String temp = sc.next();
	          int tube = 5;//记录账户
	          for(int i=0;i<5;i++){
	              if(a1[i].getAccountID().compareTo(temp)==0)
	              {
	                  tube = i;
	                  break;
	              }
	          }
	          if(tube==5)
	          {
	              System.out.println(" #:该用户不存在");
	              zhuan(a);
	          }
	          else
	          {
	              zhuan_half(a,tube);
	          }
	      }
public void zhuan_half(int a,int a_to)throws IOException {
	          System.out.println("***************************************************************");
	          System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
	          System.out.println("***************************************************************");
	          System.out.println("                   请输入转账金额;");
	          Scanner sc = new Scanner (System.in);
	          if(sc.hasNext("q"))
	              login();
	          int JinE= sc.nextInt();
	          if(JinE>a1[a].getAccountbalance())
	          {
	              System.out.println("账户余额不足");
	              zhuan_half(a,a_to);
	          }
	          else if(JinE<=0)
	              zhuan_half(a,a_to);
	          else
	          {
	              StringBuffer sxw = new StringBuffer(a1[a_to].getAccountname());
	              sxw.deleteCharAt(0);
	              System.out.println("***************************************************************");
	              System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
	              System.out.println("***************************************************************");
	              System.out.println("          请确认是否向*"+sxw+"转账"+JinE+"元。");
	              String makesure = sc.next();
	              if(sc.hasNext("q"))
	                  login();
	              if(makesure.compareTo("Y")==0)
	              {
	                  a1[a].setAccountbalance(a1[a].getAccountbalance()-JinE);
	                  a1[a].setAmount(a1[a].getAmount()+JinE);
	                  a1[a_to].setAccountbalance(a1[a_to].getAccountbalance()+JinE);
	                  a1[a_to].setAmount(a1[a_to].getAmount()+JinE);
	                  System.out.println("***************************************************************");
	                  System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
	                  System.out.println("***************************************************************");
	                  System.out.println("          当前账户向*"+sxw+"转账"+JinE+"元。");
	                  System.out.println("          当前账户余额为:"+a1[a].getAccountbalance()+"元");
	              }
	              //----------------------------------------------------<以下为文件更新阶段
	              Scanner scs = new Scanner (new FileReader(List));
	              PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
	              while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
	              {
	                  pws.println(scs.nextLine());
	              }
	              pws.println(scs.nextLine());
	              pws.close();
	              Scanner scp = new Scanner (new FileReader("files/LinShi"));
	              PrintWriter pw = new PrintWriter (new FileWriter(List));
	              pw.print(a1[a].getAccountID());
	              pw.print(" ");
	              pw.print(Today);
	              a1[a].setOperatedate(Today);
	              pw.print(" ");
	              writefile();
	              pw.print("RemoveMoney");
	              pw.print(" ");
	              pw.println(JinE);
	              while(!scp.hasNext("ENDOFTHISFILE"))
	              {
	                  pw.println(scp.nextLine());
	              }
	              pw.println(scp.nextLine());
	              pw.close();
	              //-----------------------------------
	              serviceAll(a);
	          }

}
public void xiugai(int a)throws IOException{
    System.out.println("***************************************************************");
         System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
         System.out.println("***************************************************************");
         String str1,str2;
         System.out.println("                  请输入当前密码:  ");
         Scanner sc = new Scanner (System.in);
         str1 = sc.next();
         if(sc.hasNext("q"))
             login();
         if(a1[a].getAccountpassword().compareTo(str1)==0)
         {
             System.out.println("                  请输入修改密码:");
             str1 = sc.next();
             if(sc.hasNext("q"))
                 login();
             System.out.println("                  请输入确认密码:");
             str2 = sc.next();
             if(sc.hasNext("q"))
                 login();
             if(str1.compareTo(str2)==0)
             {
                 a1[a].setAccountpassword(str1);
                 writefile();
                 System.out.println("***************************************************************");
                 System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
                 System.out.println("***************************************************************");
                 System.out.println("           当前账户密码修改成功");
                 //----------------------------------------------------<以下为文件更新阶段
                 Scanner scs = new Scanner (new FileReader(List));
                 PrintWriter pws = new PrintWriter (new FileWriter("files/LinShi"));
                 while(!scs.hasNext("ENDOFTHISFILE"))//将 List 文件里的数据临时储存在 LinShi 文件下
                 {
                     pws.println(scs.nextLine());
                 }
                 pws.println(scs.nextLine());
                 pws.close();
                 Scanner scp = new Scanner (new FileReader("files/LinShi"));
                 PrintWriter pw = new PrintWriter (new FileWriter(List));
                 pw.print(a1[a].getAccountID());
                 pw.print(" ");
                 pw.print(Today);
                 a1[a].setOperatedate(Today);
                 pw.print(" ");
                 writefile();
                 pw.print("Changeaword");
                 pw.print(" ");
                 pw.println("**********");
                 while(!scp.hasNext("ENDOFTHISFILE"))
                 {
                     pw.println(scp.nextLine());
                 }
                 pw.println(scp.nextLine());
                 pw.close();
                 //-----------------------------------
                 serviceAll(a);
             }
             else
             {
                 System.out.println("          修改密码与确认密码不一致");
                 xiugai(a);
             }
         }
         else
         {
             System.out.println("         当前密码录入错误");
             xiugai(a);
         }

	
	
	
}		
public void yu(int a)throws IOException{
	  System.out.println("***************************************************************");
	           System.out.println("   欢迎"+a1[a].getAccountname()+"使用中国工商银行自助柜员系统");
	           System.out.println("***************************************************************");
	           System.out.println("                  当前账户余额为:"+a1[a].getAccountbalance()+"元");
	           System.out.println("                    账户清单信息为:");
	           int sx = 1;
	           Scanner sl = new Scanner (new File(List));
	           while(true)
	           {
	               String str3 = sl.next();//账户
	               if(str3.compareTo("ENDOFTHISFILE")==0)
	                   break;
	               String str1 = sl.next();//日期
	               String str2 = sl.next();//操作类型
	               String dateofthis = sl.next();//操作金额
	               if(a1[a].getAccountID().compareTo(str3)==0)
	               {
	                   System.out.println(sx+"、"+str1+"  "+str2+"   "+dateofthis);
	                   sx++;
	               }
	           }
	           serviceAll(a);

	
}	
public AccountManager() throws FileNotFoundException{
         for(int i=0;i<5;i++)
             a1[i] = new Account();
         readfile();
     }
public void writefile() throws IOException{
         FileWriter fr = new FileWriter(Infor);
         BufferedWriter bw = new BufferedWriter(fr);
         PrintWriter fl = new PrintWriter(bw);
         for(int i =0;i<5;i++)
         {
             fl.print(a1[i].getAccountID());
             fl.print(' ');
             fl.print(a1[i].getAccountname());
             fl.print(' ');
             fl.print(a1[i].getOperatedate());
             fl.print(' ');
             fl.print(a1[i].getOperatetype());
             fl.print(' ');
             fl.print(a1[i].getAccountpassword());
             fl.print(' ');
             fl.print(a1[i].getAccountbalance());
             fl.print(' ');
             fl.print(a1[i].getAmount());
             fl.print("\n");
         }
         fl.close();
     }
public void readfile() throws FileNotFoundException{
         Scanner fl = new Scanner(new File(Infor));
         for(int i=0;i<5;i++)
             a1[i]=new Account(fl.next(),fl.next(),fl.next(),fl.nextInt(),fl.next(),fl.nextInt(),fl.nextInt());
     }


}
package ATM模拟;
import java.io.IOException;
public class ATM {
public static void main(String[] args)throws IOException{
    AccountManager accou = new AccountManager();
         accou.login();	
	}
}

    

  

     在这次的测试中,我也深切地感受到了java的难处,还有那种自己不会而别人在奋笔疾书的感觉。真的很难受。自己也想好好的完成这次的作业,然后好好的放松一下。因为自己的懒惰和无知,自己只能靠网上的代码。可回头又一想,等真到了我用自己的技术来讨饭碗的时候,当时的自己要是不会,那是又会是多么的难堪。真要是到了那时候就真的完了。到了大学再也没有老师拿着鞭子在你后面赶着你学习,再也没有那种在一起学习的激情。所以自己要更加地成长了,学会自我学习能力,学会好好的掌握时间,学会好好的安排生活,真正的开始学习的生活了。也要努力拼一把了,自己都没好好学过,怎末知道自己也学不好。根据我自己的经验,我还是有这个信心的。接下来,我会好好努力,好好成长。