這是一個關於銀行取款機的程序
// Cash
// A Miniproject in Bank System
//import extension packages
import javax
public class Cash
{
public static void main( String args[] )
{
/* Initializer list specifies number of element and
value for each element */
int password[] = {
int supe; // int first value
int cash =
int money =
int i =
// A do/while loop
do
{
// String a value and read in password from user
String supesum =
JOptionPane
// convert numbers from type String to type int
supe = Integer
// A if/else control structer
if ( supe==password[
|| supe==password[
|| supe==password[
|| supe==password[
|| supe==password[
|| supe==password[
break;
else
JOptionPane
}
while( i>
//show the option table for user to choose
//set a loop to see whether the choise is
int choise; // int a vlaue
while( i==
{
do
{
// String a value and read in choise from user
String inputChoise =
JOptionPane
// convert number from type string to type int
choise = Integer
switch( choise )
{
case
JOptionPane
break;
case
// String a value and read in money from user
String out =
JOptionPane
money = Integer
cash = cash
break;
case
// String a value and read in money from user
String in =
JOptionPane
money = Integer
cash = cash + money;
break;
case
JOptionPane
System
}
}
while( choise<
} //end the loop
System
} // end method close
} // end class Bank
From:http://tw.wingwit.com/Article/program/Java/Javascript/201311/25322.html