龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > JAVA开发 >

银行取款机Cash系统源程序

时间:2009-12-23 15:42来源:未知 作者:admin 点击:
分享到:
这是一个关于银行取款机的程序,觉得知识有限,请高手们帮我改改,让我的程序更加的完善!!谢谢各位!!!!! // Cash.Java // A Miniproject in Bank System //import extension packages import jav

  这是一个关于银行取款机的程序,觉得知识有限,请高手们帮我改改,让我的程序更加的完善!!谢谢各位!!!!!
  
  
   // Cash.Java
   // A Miniproject in Bank System
  
   //import extension packages
   import javax.swing.*;
  
   public class Cash
   {
   public static void main( String args[] )
   {
   /* Initializer list specifies number of element and
   value for each element */
   int passWord[] = { 1111,2222,3333,4444,5555,6666 };
   int supe; // int first value
   int cash = 8888; // number of money
   int money = 0; // int third value
   int i = 1; // number of i
  
   // A do/while loop
   do
   {
   // String a value and read in password from user
   String supesum =
   JOptionPane.showInputDialog( "Welcome to use this Cash Systerm! "+
   "Now please Enter your password :" );
  
   // convert numbers from type String to type int
   supe = Integer.parseInt( supesum );
  
   // A if/else control strUCter
   if ( supe==password[0]
   supe==password[1]
   supe==password[2]
   supe==password[3]
   supe==password[4]
   supe==password[5] )
  
   break;
  
   else
   JOptionPane.showMessageDialog(null,"You put in the password is Wrong! "+
   "Please try again" );
  
   }
   while( i>0 );
  
   //show the option table for user to choose
   //set a loop to see whether the choise is 1, 2 or 3
  
   int choise; // int a vlaue
  
   while( i==1 )
   {
  
   do
   {
   // String a value and read in choise from user
   String inputChoise =
   JOptionPane.showInputDialog ( " Enter your choise : " +
   " 1 Check your Cash-card'cash " +
   " 2 Pick out your cash " +
   " 3 Put in your cash " +
   " 4 EXIT" );
  
   // convert number from type string to type int
   choise = Integer.parseInt( inputChoise );
  
   switch( choise )
   {
   case 1 :
   JOptionPane.showMessageDialog( null,"Your Cash-Card have got " + cash );
   break;
  
   case 2 :
   // String a value and read in money from user
   String out =
   JOptionPane.showInputDialog( "How much do you want to pick out ? "+
   "Please input the cash number in the blank dialog!" );
   money = Integer.parseInt( out );
   cash = cash - money;
   break;
  
   case 3 :
   // String a value and read in money from user
   String in =
   JOptionPane.showInputDialog( "How much do you want to put in ? "+
   "Please input the cash number in the blank dialog!" );
   money = Integer.parseInt( in );
   cash = cash + money;
   break;
  
   case 4 :
   JOptionPane.showMessageDialog( null, "Thank you for use this Cash Systerm!" );
  
   System.exit(0);
   }
  
   }
   while( choise<1 choise>4 );
  
   } //end the loop
  
   System.exit(0);
  
   } // end method close
  
   } // end class Bank
  
精彩图集

赞助商链接