?? bank.java
字號:
import java.io.*;
public class Bank
{
public static void main(String[] args)
{
int balance=0;
new IdText();
do
{
System.out.println("請輸入操作序號:1.存款;2.取款;3.查詢余額;4.顯示賬號");
//new ChoiceCase();
InPut thisInPut=new InPut();
switch(thisInPut.num)
{
case 1:
System.out.print("輸入金額:");
InPut thisInPut1=new InPut();
balance+=thisInPut1.num;
break;
case 2:
System.out.print("輸入金額:");
InPut thisInPut2=new InPut();
if(balance<thisInPut2.num)
{
System.out.println("余額不足,請重新輸入");
break;
}
balance-=thisInPut2.num;
break;
case 3:
System.out.println("銀行余額:"+balance);
break;
case 4:
new IdText();
break;
default:System.out.println("操作錯誤,請重新輸入");
}
}
while (true);
}
}
class IdText
{
IdText()
{
System.out.println("賬號:Ap0506426");
System.out.println("姓名:葉光廷");
System.out.println("開戶時間:2008-10-10");
System.out.println("身份證號碼:0506426");
}
}
/*class NoChoice
{
void NoChoice()
{
System.out.println("請輸入操作序號:1.存款;2.取款;3.查詢余額;4.顯示賬號");
ChoiceCase myChoiceCase=new ChoiceCase();
}
}*/
/*class ChoiceCase
{
InPut thisInPut=new InPut();
ChoiceCase()
{
switch(thisInPut.num)
{
case 1:
System.out.print("輸入金額:");
InPut thisInPut1=new InPut();
balance=50;
break;
case 2:
System.out.print("輸入金額:");
InPut thisInPut2=new InPut();
thisInPut2.num;
break;
case 3:
System.out.println("銀行余額:"+balance);
break;
case 4:
new IdText();
break;
default:System.out.println("操作錯誤,請重新輸入");
}
}
}*/
class InPut
{
public int num;
InPut()
{
try
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
num=Integer.parseInt(br.readLine());
}
catch (IOException e)
{
System.err.println(e.toString());
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -