You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.5 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package xue;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class bankTest {
public static void main(String[] args) {
System.out.println("请先创建一个账户:");
Scanner sc=new Scanner(System.in);
System.out.print("请输入身份证件号:");
long iden=sc.nextLong();
System.out.println("请输入姓名:");
String namen=sc.next();
System.out.println("请输入首次存入金额数:");
double moneyn=sc.nextDouble();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date=sdf.format(new Date());
Bank index=new Bank(iden,moneyn,namen,date);
while(true)
{
System.out.println("请输入您要进行的操作1 存款2 取款3 查询余额; 4 退出");
int i=sc.nextInt();
switch(i)
{
case 1:
System.out.println("请输入存款金额:");
double saven=sc.nextDouble();
index.income(saven);
break;
case 2:
System.out.println("请输入取款金额:");
double taken=sc.nextDouble();
index.takeout(taken);
break;
case 3:
index.display();
break;
case 4:
sc.close();
System.exit(0);
}
}
}
}