⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbaccess.java

📁 java实现银行ATM机器业务 直接可以运行 可以实现取款、存款、转账、修改密码等业务 java 银行ATM系统
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
          ResultSet rsSQLSelect=d.executeQuery(str1);
          try{
           if(rsSQLSelect.next())
           {  
            No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
            No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
            
           }
          }
          catch(Exception er){System.out.println("查询ATM机信息出错!");}
          x_100=fetchmoney/100;
          if(No_100<x_100)
          {
           mo=fetchmoney-No_100*100;
           x_50=mo/50;
           if(x_50>No_50)
           {
            t9.setText("取款机现钞不足!");
            text2.setText("");
            cl.show(c,"6");
            return;
            
           }
           else
           {
            No_50=No_50-x_50;
            No_100=0;
           }
          }
          else
          {
           No_100=No_100-x_100;
           x_50=(fetchmoney-x_100*100)/50;
           if(x_50>No_50)
           {
            t9.setText("取款机50面值现钞不足!");
            text2.setText("");
            cl.show(c,"6");
            return;
           }
           else
           {No_50=No_50-x_50;}
          }
          String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
          String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
          d.executeUpdate(str2);
          d.executeUpdate(str3);
         
          setmoney(fetchmoney,IC_Number);
          t12.setText(Float.toString(fetchmoney));
          cl.show(c,"7");
          text2.setText("");
      }

    if(e.getSource()==z14)                                    //打印
    {  t14.setText(Long.toString(opNum));
       opNum=opNum+1;
     IC_Number=text1.getText().trim();
     t16.setText(IC_Number);
       t18.setText(Float.toString(fetchmoney));
       Date dd=new Date();    
       String tt=""+dd;
       t20.setText(tt);
       cl.show(c,"8");


        }
  if(e.getSource()==z13||e.getSource()==z15||e.getSource()==z17||e.getSource()==z20||e.getSource()==z21||e.getSource()==z29||e.getSource()==z30)
  {
   cl.show(c,"4");
  }
  if(e.getSource()==z19)
     { DBAccess d=new DBAccess();
       IC_Number=text1.getText().trim();
       IC_No=text3.getText().trim();
       if(IC_No.equals(IC_Number))
       {
        t23.setText("您输入的帐号为现登录帐号!");
        text3.setText("");
        text4.setText("");
        cl.show(c,"9");
        return;
       }
       moneys=Float.parseFloat(text4.getText());
       if(moneys<=0)
       {
        t23.setText("转帐金额非法!");
        text3.setText("");
        text4.setText("");
        cl.show(c,"9");
        return;
       }
       leftmoney=getmoney(IC_Number);
       if(!getname(IC_No))
         {
           text3.setText("");
           text4.setText("");
           t23.setText("您输入的帐号错误!");
           cl.show(c,"9");
           return;
          }
       if(leftmoney<moneys)
         {
           t23.setText("您的余额不足,请重新输入!");
           text4.setText("");
           cl.show(c,"9");
           return;
          }
     mon=getmoney(IC_No);
     money1=leftmoney-moneys;
     money2=mon+moneys;
     String str1="";
     String str2="";
     str1="update IC set money="+money1+"WHERE IC_ID='"+IC_Number+"'";
     str2="update IC set money="+money2+"WHERE IC_ID='"+IC_No+"'";
     if(d.executeUpdate(str1)&&d.executeUpdate(str2))
       {
        t23.setText("转帐成功!    您的转帐金额为"+moneys);
        text3.setText("");
        text4.setText("");
        cl.show(c,"9");
        return;
        }
     }
    
 if(e.getSource()==z23)
  {  
      IC_Number=text1.getText().trim();
      fetchmoney=100;
      int No_50=0,No_100=0,x_50=0,x_100=0,mo=0; 
        String str1="select NO_50,NO_100 from ATM where ATM_ID='123456789'";
        ResultSet rsSQLSelect=executeQuery(str1);
        try{
         if(rsSQLSelect.next())
         {  
          No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
          No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
          
         }
        }
        catch(Exception er){System.out.println("查询ATM机信息出错!");}
     
       
        x_100=fetchmoney/100;
        if(No_100<x_100)
        {
         mo=fetchmoney-No_100*100;
         x_50=mo/50;
         if(x_50>No_50)
         {
          t33.setText("取款机现钞不足!");
          z30.setVisible(true);
          cl.show(c,"5");
          return;
          
         }
         else
         {
          No_50=No_50-x_50;
          No_100=0;
         }
        }
        else
        {
         No_100=No_100-x_100;
         x_50=(fetchmoney-x_100*100)/50;
         if(x_50>No_50)
         {
          t33.setText("取款机50面值现钞不足!");
          cl.show(c,"5");
          return;
         }
         else
         {No_50=No_50-x_50;}
        }
    
        String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
        String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
        executeUpdate(str2);
        executeUpdate(str3);
      if(setmoney(fetchmoney,IC_Number))
      {
         t12.setText("100");
         cl.show(c,"7");
      }
  }
 
  if(e.getSource()==z24)
  {
   IC_Number=text1.getText().trim();
   fetchmoney=200;
   int No_50=0,No_100=0,x_50=0,x_100=0,mo=0; 
        String str1="select NO_50,NO_100 from ATM where ATM_ID='123456789'";
        ResultSet rsSQLSelect=executeQuery(str1);
        try{
         if(rsSQLSelect.next())
         {  
          No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
          No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
          
         }
        }
        catch(Exception er){System.out.println("查询ATM机信息出错!");}
       
        x_100=fetchmoney/100;
        if(No_100<x_100)
        {
         mo=fetchmoney-No_100*100;
         x_50=mo/50;
         if(x_50>No_50)
         {
          t33.setText("取款机现钞不足!");
          z30.setVisible(true);
          cl.show(c,"5");
          return;
          
         }
         else
         {
          No_50=No_50-x_50;
          No_100=0;
         }
        }
        else
        {
         No_100=No_100-x_100;
         x_50=(fetchmoney-x_100*100)/50;
         if(x_50>No_50)
         {
          t33.setText("取款机50面值现钞不足!");
          cl.show(c,"5");
          return;
         }
         else
         {No_50=No_50-x_50;}
        } 
        String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
        String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
        executeUpdate(str2);
        executeUpdate(str3);
   if(setmoney(fetchmoney,IC_Number))
    
   {t12.setText("200");
      cl.show(c,"7");
   }
  }

  if(e.getSource()==z25)
  {
   IC_Number=text1.getText().trim();
   fetchmoney=300;
   int No_50=0,No_100=0,x_50=0,x_100=0,mo=0; 
        String str1="select NO_50,NO_100 from ATM where ATM_ID='123456789'";
        ResultSet rsSQLSelect=executeQuery(str1);
        try{
         if(rsSQLSelect.next())
         {  
          No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
          No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
          
         }
        }
        catch(Exception er){System.out.println("查询ATM机信息出错!");}
       
        x_100=fetchmoney/100;
        if(No_100<x_100)
        {
         mo=fetchmoney-No_100*100;
         x_50=mo/50;
         if(x_50>No_50)
         {
          t33.setText("取款机现钞不足!");
          z30.setVisible(true);
          cl.show(c,"5");
          return;
          
         }
         else
         {
          No_50=No_50-x_50;
          No_100=0;
         }
        }
        else
        {
         No_100=No_100-x_100;
         x_50=(fetchmoney-x_100*100)/50;
         if(x_50>No_50)
         {
          t33.setText("取款机50面值现钞不足!");
          cl.show(c,"5");
          return;
         }
         else
         {No_50=No_50-x_50;}
        } 
        String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
        String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
        executeUpdate(str2);
        executeUpdate(str3);
   if(setmoney(fetchmoney,IC_Number))
    
      {t12.setText("300");
      cl.show(c,"7");
      }
    
  }
 
 
  if(e.getSource()==z26)
  {
   IC_Number=text1.getText().trim();
   int fetchmoney=500;
   int No_50=0,No_100=0,x_50=0,x_100=0,mo=0; 
        String str1="select NO_50,NO_100 from ATM where ATM_ID='123456789'";
        ResultSet rsSQLSelect=executeQuery(str1);
        try{
         if(rsSQLSelect.next())
         {  
          No_50=Integer.parseInt(rsSQLSelect.getString("NO_50"));
          No_100=Integer.parseInt(rsSQLSelect.getString("NO_100"));
          
         }
        }
        catch(Exception er){System.out.println("查询ATM机信息出错!");}
       
        x_100=fetchmoney/100;
        if(No_100<x_100)
        {
         mo=fetchmoney-No_100*100;
         x_50=mo/50;
         if(x_50>No_50)
         {
          t33.setText("取款机现钞不足!");
          z30.setVisible(true);
          cl.show(c,"5");
          return;
          
         }
         else
         {
          No_50=No_50-x_50;
          No_100=0;
         }
        }
        else
        {
         No_100=No_100-x_100;
         x_50=(fetchmoney-x_100*100)/50;
         if(x_50>No_50)
         {
          t33.setText("取款机50面值现钞不足!");
          cl.show(c,"5");
          return;
         }
         else
         {No_50=No_50-x_50;}
        }
          
        String str2="update ATM set NO_50="+No_50+" where ATM_ID='"+ATM_id+"'";
        String str3="update ATM set NO_100="+No_100+" where ATM_ID='"+ATM_id+"'";
        executeUpdate(str2);
        executeUpdate(str3);
   if(setmoney(fetchmoney,IC_Number))
      {t12.setText("500");
       cl.show(c,"7");
       }
    
  }
 
  if(e.getSource()==z27)
  {
   t9.setText("");
   cl.show(c,"6");
  }
  if(e.getSource()==z28)
     {
       String password1="";
       String password2="";
       IC_Number=text1.getText().trim();
       password1=pw2.getText().trim();
       password2=pw3.getText().trim();
       if(password1.equals(password2))
        { if(alterpassword(password1,IC_Number))
           {
             t28.setText("密码修改成功!");
             pw2.setText("");
             pw3.setText("");
             cl.show(c,"11");
           }
         }
       else
          {
            t28.setText("您输入的密码不一致,请重新输入!");
            pw2.setText("");
            pw3.setText("");
            cl.show(c,"11");
           }

        }

   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -