//信1705-2 张小军 20173662
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
public class AccountManager
{
public static void main(String[] args)
{
public static boolean loginAccount(String accountID) throws IOException {
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t请输入您的账号:\n");
String checkAccount = s.next();
if (accountID.equals (checkAccount)){
System.out.println("输入账号成功,系统跳转到输入密码界面\n");
return true ;
}else {
System.out.println("该账号不存在");
return false ;
}
}
//打印登陆密码界面
public static boolean loginPwd(String accountpassword) throws IOException {
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
for (int i = 3 ;i>0;i--){
System.out.println("\t\t请输入您的密码:\n");
String checkPwd = s.next();
if (accountpassword.equals (checkPwd)){
System.out.println("输入密码成功,系统跳转到主界面!\n");
return true ;
}else {
if ( i ==1 ){
System.out.println("该账号三次录入密码错误,该卡已被系统没收,请与工行及时联系处理");
return false ;
}
System.out.println("密码录入错误!今日剩余次数:"+ (i-1));
}
}
return false;
}
//存款
private static void handmoney(int accountbalance,int amount) {
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t请输入存款金额:\n");
amount=s.nextInt();
accountbalance+=amount;
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t当前账户存款操作成功\n");
System.out.println("\t\t当前账户余额为"+accountbalance+"元\n");
System.out.println("\t*************************************************\n");
Menu();
System.out.println("\t\t请继续操作\n");
}
//取款
public static void getmoney(int accountbalance,int amount) {
accountbalance+=amount;
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t当前账户每日可以支取2万元\n");
System.out.println("\t\t1.100元\n");
System.out.println("\t\t2.500元\n");
System.out.println("\t\t3.1000元\n");
System.out.println("\t\t4.1500元\n");
System.out.println("\t\t5.2000元\n");
System.out.println("\t\t6.5000元\n");
System.out.println("\t\t7.其他金额\n");
System.out.println("\t\t8.退卡\n");
System.out.println("\t\t9.返回\n");
System.out.println("\t*************************************************\n");
int str=s.nextInt();
if (str > 20000){
System.out.println("单次最大取款金额为1000.0元");
str=0;
}else if (str < 0){
System.out.println("不能取负数的钱!!");
str=0;
}else if (accountbalance <str ){
System.out.println("账户余额不足!!");
str=0;
}else {
accountbalance-=str;
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t当前账户存款操作成功\n");
System.out.println("\t\t当前账户余额为"+accountbalance+"元\n");
System.out.println("\t*************************************************\n");
}
Menu();
}
//转账汇款
public static void moneygogogo(String accountID,int accountbalance,int amount) {
accountbalance+=amount;
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t请输入转账账户\n");
String str=s.next();
if(accountID.equals(str)) {
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t请输入转账金额\n");
int num=s.nextInt();
if(accountbalance<=num){
System.out.println("账户余额不足");
}else {
accountbalance-=num;
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t当前账户向"+accountID+"成功转账"+num+"元");
System.out.println("\t\t当前账户余额为"+accountbalance+"元\n");
System.out.println("\t*************************************************\n");
}
}
Menu();
}
//修改密码
public static void update(String accountpassword) {
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t请输入当前密码:\n");
String str=s.next();
if(!accountpassword.equals(str)) {
System.out.println("当前密码录入错误");
}else {
System.out.println("\t\t请输入修改密码:\n");
String str1=s.next();
System.out.println("\t\t请输入确认密码:\n");
String str2=s.next();
if(!str1.equals(str2)) {
System.out.println("修改密码与确认密码不一致");
}else {
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.println("\t\t当前账户密码修改成功");
System.out.println("\t*************************************************\n");
}
}
}
//查询余额
public static void moneyhere(int accountbalance,String operatedate,int amount) {
System.out.println("\t*************************************************\n");
System.out.println("\t 欢迎全世界最有钱的人使用中国工商银行自助柜员系统\n");
System.out.println("\t*************************************************\n");
System.out.print("\t\t当前账户余额为元"+accountbalance+"元\n");
System.out.print("\t\t账户清单信息为:\n");
System.out.print("\t\t操作日期"+operatedate+" 操作类型1 2 3 4 5"+"操作金额"+amount+"\n");
System.out.println("\t*************************************************\n");
Menu();
}
import java.text.SimpleDateFormat;
import java.util.Date;
public class Account
{
private String accountID,accountname,operatedate,accontpassword;
private int operatetype,accountbalance,amount;//“1”表示存款,“2”表示取款,“3”表示转账汇款,“4”表示修改账户密码,“5”表示查询余额。
public Account() {}
public Account(String accountID,String accountname,String accontpassword,int accountbalance)
{
this.accountID = accountID;
this.accountname = accountname;
this.accontpassword = accontpassword;
this.accountbalance = accountbalance;
}
public int getAccountbalance()
{
return accountbalance;
}
public void setAccountbalance(int accountbalance)
{
this.accountbalance = accountbalance;
}
public String getAccountID()
{
return accountID;
}
public void setAccountID(String accountID)
{
this.accountID = accountID;
}
public String getAccountname()
{
return accountname;
}
public void setAccountname(String accountname)
{
this.accountname = accountname;
}
public String getOperatedate()
{
return operatedate;
}
public void setOperatedate()
{
Date now = new Date( );
SimpleDateFormat ft = new SimpleDateFormat ("yyyy.MM.dd");
this.operatedate = ft.format(now);
}
public String getAccontpassword()
{
return accontpassword;
}
public void setAccontpassword(String accontpassword)
{
this.accontpassword = accontpassword;
}
public int getOperatetype()
{
return operatetype;
}
public void setOperatetype(int operatetype)
{
this.operatetype = operatetype;
}
public int getAmount()
{
return amount;
}
public void setAmount(int amount)
{
this.amount = amount;
}
}