zoukankan      html  css  js  c++  java
  • java考试

    package ATM;
    import java.util.Scanner;
    /**
     * 操作学生数据
     * 
     * @author Administrator
     *
     */ 
    public class AccountManager { 
      static Scanner sc = new Scanner(System.in);
      
        
      
         /**
          * 主菜单
          */ 
         public static void menu()
         {
         System.out.println("*********************************");
         System.out.println("欢迎使用中国工商银行自助系统");
         System.out.println("*********************************");
         System.out.println("请输入您的帐号:");
         System.out.println("*********************************");
         int flag=1;
         while(flag==1)
         {
         String num= sc.next();
         if(num.length()!=8)
         {System.out.println("输入错误,请重新输入");
          flag=1;
         }
         else flag=0;
         }
         if(flag==0)
          
          {System.out.println("*********************************");
          System.out.println("欢迎使用中国工商银行自助系统");
          System.out.println("*********************************");
          System.out.println("请输入您的密码:");
          System.out.println("*********************************");
          }
         int index=1;
          for(int i=0;i<3;i++)
          {
          String word=sc.next();
          if(word.length()!=6)
          {System.out.println("输入错误,请重新输入");
          index=0;
          }
          else break;
          }
          if(index==0)
           System.out.println("输入密码三次错误,卡已被没收");
          }
         
          }
     
     
    package ATM;

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.ArrayList;

    public class read
    {
     
      
      
       
     
         public static ArrayList<String> accountID= new ArrayList<String>();
      public static ArrayList<String> accountname = new ArrayList<String>();
      public static ArrayList<String> accountpssword= new ArrayList<String>(); 
         public static ArrayList<Integer> accountbalance = new ArrayList<Integer>();
         public static File file = new File("D:\accountinformation.txt");
     
         static { 
      
             ArrayList<String> temp = new ArrayList<String>(); 
             try { 
                 BufferedReader br = new BufferedReader(new FileReader(file)); 
      
                 String read = br.readLine(); 
                 while (read != null) { 
                     temp.add(read); 
                     read = br.readLine(); 
                 } 
                 br.close(); 
             } catch (FileNotFoundException e) { 
                 // TODO Auto-generated catch block 
                 e.printStackTrace(); 
             } catch (IOException e) { 
                 // TODO Auto-generated catch block 
                 e.printStackTrace(); 
             } 
      
             for (int i = 0; i < temp.size(); i++) { 
                 String[] sTemp = ((String) temp.get(i)).split(","); 
        accountID.add(sTemp[0]); 
                 accountname.add(sTemp[1]); 
                 accountpssword.add(sTemp[2]);
           
                 accountbalance.add(Integer.parseInt(sTemp[3])); 
             } 
      
         } 
      
     } 
     
     
     
     
    package ATM;

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileNotFoundException;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.ArrayList;

    public class read2
    {
     
      
      
       
     
         public static ArrayList<String> accountID= new ArrayList<String>();
      public static ArrayList<String> accountname = new ArrayList<String>();
      public static ArrayList<String> operatedate= new ArrayList<String>(); 
         public static ArrayList<Integer> operatetype = new ArrayList<Integer>();
         public static ArrayList<Integer> amount = new ArrayList<Integer>();
         public static File file = new File("D:\accountlist.txt");
     
         static { 
      
             ArrayList<String> tem = new ArrayList<String>(); 
             try { 
                 BufferedReader cr = new BufferedReader(new FileReader(file)); 
      
                 String read = cr.readLine(); 
                 while (read != null) { 
                     tem.add(read); 
                     read = cr.readLine(); 
                 } 
                 cr.close(); 
             } catch (FileNotFoundException e) { 
                 // TODO Auto-generated catch block 
                 e.printStackTrace(); 
             } catch (IOException e) { 
                 // TODO Auto-generated catch block 
                 e.printStackTrace(); 
             } 
      
             for (int i = 0; i < tem.size(); i++) { 
                 String[] sTemp = ((String) tem.get(i)).split(","); 
        accountID.add(sTemp[0]); 
                 accountname.add(sTemp[1]); 
                 operatedate.add(sTemp[2]);
           
                 operatetype.add(Integer.parseInt(sTemp[3])); 
                 amount.add(Integer.parseInt(sTemp[4]));
             } 
      
         } 
      
     } 
     
     
    package ATM;
    public class test {
     public static void main(String[] args)
     {
      AccountManager.menu();
      // TODO Auto-generated method stub
     }
    }
  • 相关阅读:
    Linux常用命令,touch命令,vi和vim命令,文件查看命令,文本处理命令,备份压缩命令,网络与磁盘命令,软件安装命令
    Linux命令整理,用户管理命令,用户组管理命令,系统管理命令,目录管理常用命令
    单元测试基本步骤?单元测试三个常用注解?日志体系结构和log4j,Log4j三个核心?
    cookies,sessionStorage 和 localStorage 之间有什么区别?
    filter() 、find()、findIndex()
    设置多行文本隐藏显示省略号时样式丢失了
    react 中封装一个简单的滚动条组件
    react-router-cache-router
    浅谈React 中 Component与PureComponent如何使用
    React.Fragment
  • 原文地址:https://www.cnblogs.com/Evak/p/9687920.html
Copyright © 2011-2022 走看看