Java测试程序
package account;
import java.util.Scanner;
public class Account {
private String accountID,accountname,operatedate,accountpassword;
private int operatetype;
static int accountbalance;
private int account;
public void setacconutID(String accountID)
{
this.accountID=accountID;
}
public void setaccountname(String accountname)
{this.accountname=accountname;}
public void setoperatedate(String operatedate)
{this.operatedate=operatedate;}
public void setsex(int operatetype)
{this.operatetype=operatetype;}
public void setscore(String accountpassword)
{this.accountpassword=accountpassword;}
public void setaccountbalance(int accountbalance)
{
this.accountbalance=accountbalance;
}
public void setaccount(int account)
{
this.account=account;
}
public String getaccountID()
{return accountID;}
public String getaccountname()
{return accountname;}
public String getoperatedate()
{return operatedate;}
public int getoperatetype()
{return operatetype;}
public String getaccountpassword()
{return accountpassword;}
public int getaccountbalance()
{
return accountbalance;
}
public int getaccount()
{
return account;
}
public Account(String accountID,String accountname,String operatedate,int operatetype,String accountpassword,int accountbalance,int account )
{
accountID="20173519";
accountname="张昊妍";
operatedate="2018-09-20";
accountbalance=100;
this.accountID=accountID;
this.accountname=accountname;
this.operatedate=operatedate;
this.operatetype=operatetype;
this.accountpassword=accountpassword ;
this.accountbalance=accountbalance;
this.account=account;
}
}
class accountmanger{
static int num=0;
static Account[] yonghu=new Account[5] ;
static Scanner sc=new Scanner(System.in);
public static void main(String[] args) {
System.out.println("*******************************************");
System.out.println(" 欢迎使用中国工商银行自动柜员系统 ");
System.out.println("********************************************");
System.out.println("请输入您的账号:");
String accountID=sc.next();
System.out.println("*******************************************");
System.out.println("欢迎"+accountID );
System.out.println("使用中国工商银行自助柜员系统");
System.out.println("*******************************************");
System.out.println("请输入您的密码:");
String accountpassword=sc.next();
System.out.println("密码正确");
System.out.println("*******************************************");
System.out.println("欢迎"+accountID );
System.out.println("使用中国工商银行自助柜员系统");
System.out.println("*******************************************");
System.out.println(" 1、 存款 ");
System.out.println(" 2、取款 ");
System.out.println(" 3、转账汇款 ");
System.out.println(" 4、修改密码 ");
System.out.println(" 5、查询余额 ");
System.out.println("请输入数字执行相应的功能");
int x=sc.nextInt();
switch(x)
{
case 1:
{
System.out.println("*******************************************");
System.out.println("欢迎"+accountID );
System.out.println("使用中国工商银行自助柜员系统");
System.out.println("*******************************************");
System.out.println("请输入存款金额:");
String accountbalanc;
do {
try {
accountbalanc = sc.next();
if(Integer.valueOf(accountbalanc) instanceof Integer)
{
System.out.println("输入为整数");
break;
}
else
{
accountbalanc=sc.next();
}
}
catch(Exception e)
{
System.out.println("请输入整数");
}
}while (true);
System.out.println("*******************************************");
System.out.println("欢迎"+accountID );
System.out.println("使用中国工商银行自助柜员系统");
System.out.println("*******************************************");
System.out.println("当前账户存款操作成功");
System.out.println("当前账户余额为:"+(Account.accountbalance+accountbalanc));
}
case 2:
{
System.out.println("*******************************************");
System.out.println("欢迎"+accountID );
System.out.println("使用中国工商银行自助柜员系统");
System.out.println("*******************************************");
System.out.println(" 当前账户每日可以支取2万元。 ");
System.out.println(" 1、100元");
System.out.println(" 2、500元");
System.out.println(" 3、1000元");
System.out.println(" 4、1500元");
System.out.println(" 5、2000元");
System.out.println(" 6、5000元");
System.out.println(" 7、其他金额");
System.out.println(" 8、退卡");
System.out.println(" 9、返回");
System.out.println("*******************************************");
System.out.println("请选择要支取的金额");
int n=sc.nextInt();
int m=sc.nextInt();
if(m==9)
{
System.out.println("*******************************************");
System.out.println(" 欢迎使用中国工商银行自动柜员系统 ");
System.out.println("********************************************");
System.out.println("请输入您的账号:");
String accountID1=sc.next();
System.out.println("支取成功");
}
}
}
}
}