PTA7~9题目集总结与归纳
前言:
总结三次题目集的知识点、题量、难度等情况。
目录:
- 题目集7(7-1)、(7-2)两道题目的递进式设计分析总结
- 题目集8和题目集9两道ATM机仿真题目的设计思路分析总结
一. 题目集7(7-1)、(7-2)两道题目的递进式设计分析总结
掌握类的继承、多态性使用方法以及接口的应用。详见作业指导书 2020-OO第07次作业-1指导书V1.0.pdf
输入格式:
- 首先,在一行上输入一串数字(1~4,整数),其中,1代表圆形卡片,2代表矩形卡片,3代表三角形卡片,4代表梯形卡片。各数字之间以一个或多个空格分隔,以“0”结束。例如:
1 3 4 2 1 3 4 2 1 3 0
- 然后根据第一行数字所代表的卡片图形类型,依次输入各图形的相关参数,例如:圆形卡片需要输入圆的半径,矩形卡片需要输入矩形的宽和长,三角形卡片需要输入三角形的三条边长,梯形需要输入梯形的上底、下底以及高。各数据之间用一个或多个空格分隔。
输出格式:
- 如果图形数量非法(小于0)或图形属性值非法(数值小于0以及三角形三边不能组成三角形),则输出
Wrong Format
。 - 如果输入合法,则正常输出,所有数值计算后均保留小数点后两位即可。输出内容如下:
- 排序前的各图形类型及面积,格式为
图形名称1:面积值1图形名称2:面积值2 …图形名称n:面积值n
,注意,各图形输出之间用空格分开,且输出最后存在一个用于分隔的空格; - 排序后的各图形类型及面积,格式同排序前的输出;
- 所有图形的面积总和,格式为
Sum of area:总面积值
。
输入样例1:
在这里给出一组输入。例如:
1 5 3 2 0
输出样例1:
在这里给出相应的输出。例如:
Wrong Format
输入样例2:
在这里给出一组输入。例如:
4 2 1 3 0
3.2 2.5 0.4 2.3 1.4 5.6 2.3 4.2 3.5
输出样例2:
在这里给出相应的输出。例如:
The original list:
Trapezoid:1.14 Rectangle:3.22 Circle:98.52 Triangle:4.02
The sorted list:
Circle:98.52 Triangle:4.02 Rectangle:3.22 Trapezoid:1.14
Sum of area:106.91
输入样例3:
在这里给出一组输入。例如:
4 2 1 3 0
3.2 2.5 0.4 2.3 1.4 5.6 2.3 4.2 8.4
输出样例3:
在这里给出相应的输出。例如:
Wrong Format
掌握类的继承、多态性使用方法以及接口的应用。 具体需求参考作业指导书。
输入格式:
- 在一行上输入一串数字(1~4,整数),其中,1代表圆形卡片,2代表矩形卡片,3代表三角形卡片,4代表梯形卡片。各数字之间以一个或多个空格分隔,以“0”结束。例如:
1 3 4 2 1 3 4 2 1 3 0
- 根据第一行数字所代表的卡片图形类型,依次输入各图形的相关参数,例如:圆形卡片需要输入圆的半径,矩形卡片需要输入矩形的宽和长,三角形卡片需要输入三角形的三条边长,梯形需要输入梯形的上底、下底以及高。各数据之间用一个或多个空格分隔。
输出格式:
- 如果图形数量非法(<=0)或图形属性值非法(数值<0以及三角形三边不能组成三角形),则输出
Wrong Format
。 - 如果输入合法,则正常输出,所有数值计算后均保留小数点后两位即可。输出内容如下:
- 排序前的各图形类型及面积,格式为
[图形名称1:面积值1图形名称2:面积值2 …图形名称n:面积值n ]
,注意,各图形输出之间用空格分开,且输出最后存在一个用于分隔的空格,在结束符“]”之前; - 输出分组后的图形类型及面积,格式为
[圆形分组各图形类型及面积][矩形分组各图形类型及面积][三角形分组各图形类型及面积][梯形分组各图形类型及面积]
,各组内格式为图形名称:面积值
。按照“Circle、Rectangle、Triangle、Trapezoid”的顺序依次输出; - 各组内图形排序后的各图形类型及面积,格式同排序前各组图形的输出;
- 各组中面积之和的最大值输出,格式为
The max area:面积值
。
输入样例1:
在这里给出一组输入。例如:
1 5 3 2 0
输出样例1:
在这里给出相应的输出。例如:
Wrong Format
输入样例2:
在这里给出一组输入。例如:
4 2 1 3 0
3.2 2.5 0.4 2.3 1.4 5.6 2.3 4.2 3.5
输出样例2:
在这里给出相应的输出。例如:
The original list:
[Trapezoid:1.14 Rectangle:3.22 Circle:98.52 Triangle:4.02 ]
The Separated List:
[Circle:98.52 ][Rectangle:3.22 ][Triangle:4.02 ][Trapezoid:1.14 ]
The Separated sorted List:
[Circle:98.52 ][Rectangle:3.22 ][Triangle:4.02 ][Trapezoid:1.14 ]
The max area:98.52
输入样例3:
在这里给出一组输入。例如:
2 1 2 1 1 3 3 4 4 1 1 1 2 1 0
2.3 3.5 2.5 4.5 2.1 2.6 8.5 3.2 3.1 3.6 8.5 7.5 9.1245 6.5 3.4 10.2 11.2 11.6 15.4 5.8 2.13 6.2011 2.5 6.4 18.65
输出样例3:
在这里给出相应的输出。例如:
The original list:
[Rectangle:8.05 Circle:19.63 Rectangle:9.45 Circle:21.24 Circle:226.98 Triangle:4.65 Triangle:29.80 Trapezoid:50.49 Trapezoid:175.56 Circle:105.68 Circle:14.25 Circle:120.81 Rectangle:16.00 Circle:1092.72 ]
The Separated List:
[Circle:19.63 Circle:21.24 Circle:226.98 Circle:105.68 Circle:14.25 Circle:120.81 Circle:1092.72 ][Rectangle:8.05 Rectangle:9.45 Rectangle:16.00 ][Triangle:4.65 Triangle:29.80 ][Trapezoid:50.49 Trapezoid:175.56 ]
The Separated sorted List:
[Circle:1092.72 Circle:226.98 Circle:120.81 Circle:105.68 Circle:21.24 Circle:19.63 Circle:14.25 ][Rectangle:16.00 Rectangle:9.45 Rectangle:8.05 ][Triangle:29.80 Triangle:4.65 ][Trapezoid:175.56 Trapezoid:50.49 ]
The max area:1601.31
输入样例4:
在这里给出一组输入。例如:
1 1 3 0
6.5 12.54 3.6 5.3 6.4
输出样例4:
在这里给出相应的输出。例如:
The original list:
[Circle:132.73 Circle:494.02 Triangle:9.54 ]
The Separated List:
[Circle:132.73 Circle:494.02 ][][Triangle:9.54 ][]
The Separated sorted List:
[Circle:494.02 Circle:132.73 ][][Triangle:9.54 ][]
The max area:626.75
聚合二Main类:
二·题目集8和题目集9两道ATM机仿真题目的设计思路分析总结
设计ATM仿真系统,具体要求参见作业说明。 OO作业8-1题目说明.pdf
输入格式:
每一行输入一次业务操作,可以输入多行,最终以字符#终止。具体每种业务操作输入格式如下:
- 存款、取款功能输入数据格式:
卡号 密码 ATM机编号 金额
(由一个或多个空格分隔), 其中,当金额大于0时,代表取款,否则代表存款。 - 查询余额功能输入数据格式:
卡号
输出格式:
①输入错误处理
- 如果输入卡号不存在,则输出
Sorry,this card does not exist.
。 - 如果输入ATM机编号不存在,则输出
Sorry,the ATM's id is wrong.
。 - 如果输入银行卡密码错误,则输出
Sorry,your password is wrong.
。 - 如果输入取款金额大于账户余额,则输出
Sorry,your account balance is insufficient.
。 - 如果检测为跨行存取款,则输出
Sorry,cross-bank withdrawal is not supported.
。
②取款业务输出
输出共两行,格式分别为:
[用户姓名]在[银行名称]的[ATM编号]上取款¥[金额]
当前余额为¥[金额]
其中,[]说明括起来的部分为输出属性或变量,金额均保留两位小数。
③存款业务输出
输出共两行,格式分别为:
[用户姓名]在[银行名称]的[ATM编号]上存款¥[金额]
当前余额为¥[金额]
其中,[]说明括起来的部分为输出属性或变量,金额均保留两位小数。
④查询余额业务输出
¥[金额]
金额保留两位小数。
输入样例1:
在这里给出一组输入。例如:
6222081502001312390 88888888 06 -500.00
#
输出样例1:
在这里给出相应的输出。例如:
张无忌在中国工商银行的06号ATM机上存款¥500.00
当前余额为¥10500.00
输入样例2:
在这里给出一组输入。例如:
6217000010041315709 88888888 02 3500.00
#
输出样例2:
在这里给出相应的输出。例如:
杨过在中国建设银行的02号ATM机上取款¥3500.00
当前余额为¥6500.00
输入样例3:
在这里给出一组输入。例如:
6217000010041315715
#
输出样例3:
在这里给出相应的输出。例如:
¥10000.00
输入样例4:
在这里给出一组输入。例如:
6222081502001312390 88888888 06 -500.00
6222081502051320786 88888888 06 1200.00
6217000010041315715 88888888 02 1500.00
6217000010041315709 88888888 02 3500.00
6217000010041315715
#
输出样例4:
在这里给出相应的输出。例如:
张无忌在中国工商银行的06号ATM机上存款¥500.00
当前余额为¥10500.00
韦小宝在中国工商银行的06号ATM机上取款¥1200.00
当前余额为¥8800.00
杨过在中国建设银行的02号ATM机上取款¥1500.00
当前余额为¥8500.00
杨过在中国建设银行的02号ATM机上取款¥3500.00
当前余额为¥5000.00
¥5000.00
思路与应用:
import java.util.ArrayList; import java.util.Scanner; import java.util.Iterator; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); UnionPay unionPay = new UnionPay(); Bank ccb = new Bank("1001","中国建设银行"); Bank icbc = new Bank("1002","中国工商银行"); unionPay.addBank(ccb); unionPay.addBank(icbc); ATM aTM1 = new ATM("01",ccb); ATM aTM2 = new ATM("02",ccb); ATM aTM3 = new ATM("03",ccb); ATM aTM4 = new ATM("04",ccb); ATM aTM5 = new ATM("05",icbc); ATM aTM6 = new ATM("06",icbc); ccb.addATM(aTM1); ccb.addATM(aTM2); ccb.addATM(aTM3); ccb.addATM(aTM4); icbc.addATM(aTM5); icbc.addATM(aTM6); User Yangguo = new User("360101200102122324","杨过","13856223254"); User Guojing = new User("360101200012302552","郭靖","13800021124"); User Zhangwuji = new User("360502199805163221","张无忌","13952110011"); User Weixiaobao = new User("360201200513243326","韦小宝","13025996587"); Account ccbAcc1 = new Account("3217000010041315709",10000.00,Yangguo,ccb); Account ccbAcc2 = new Account("3217000010041315715",10000.00,Yangguo,ccb); Account ccbAcc3 = new Account("3217000010051320007",10000.00,Guojing,ccb); Account icbcAcc1 = new Account("3222081502001312389",10000.00,Zhangwuji,icbc); Account icbcAcc2 = new Account("3222081502001312390",10000.00,Zhangwuji,icbc); Account icbcAcc3 = new Account("3222081502001312399",10000.00,Zhangwuji,icbc); Account icbcAcc4 = new Account("3222081502051320785",10000.00,Weixiaobao,icbc); Account icbcAcc5 = new Account("3222081502051320786",10000.00,Weixiaobao,icbc); ccb.addAccount(ccbAcc1); ccb.addAccount(ccbAcc2); ccb.addAccount(ccbAcc3); icbc.addAccount(icbcAcc1); icbc.addAccount(icbcAcc2); icbc.addAccount(icbcAcc3); icbc.addAccount(icbcAcc4); icbc.addAccount(icbcAcc5); Yangguo.addAccount(ccbAcc1); Yangguo.addAccount(ccbAcc2); Guojing.addAccount(ccbAcc3); Zhangwuji.addAccount(icbcAcc1); Zhangwuji.addAccount(icbcAcc2); Zhangwuji.addAccount(icbcAcc3); Weixiaobao.addAccount(icbcAcc4); Weixiaobao.addAccount(icbcAcc5); Card ccbCard1 = new Card("6217000010041315709","88888888",ccbAcc1); Card ccbCard2 = new Card("6217000010041315715","88888888",ccbAcc1); Card ccbCard3 = new Card("6217000010041315718","88888888",ccbAcc2); Card ccbCard4 = new Card("6217000010051320007","88888888",ccbAcc3); Card icbcCard5 = new Card("6222081502001312389","88888888",icbcAcc1); Card icbcCard6 = new Card("6222081502001312390","88888888",icbcAcc2); Card icbcCard7 = new Card("6222081502001312399","88888888",icbcAcc3); Card icbcCard8 = new Card("6222081502001312400","88888888",icbcAcc3); Card icbcCard9 = new Card("6222081502051320785","88888888",icbcAcc4); Card icbcCard10 = new Card("6222081502051320786","88888888",icbcAcc5); ccbAcc1.addCard(ccbCard1); ccbAcc1.addCard(ccbCard2); ccbAcc2.addCard(ccbCard3); ccbAcc3.addCard(ccbCard4); icbcAcc1.addCard(icbcCard5); icbcAcc2.addCard(icbcCard6); icbcAcc3.addCard(icbcCard7); icbcAcc3.addCard(icbcCard8); icbcAcc4.addCard(icbcCard9); icbcAcc5.addCard(icbcCard10); StringBuilder sb = new StringBuilder(); String data; while(!((data = input.nextLine()).equals("#"))) { sb.append(data + "\n"); } String[] dt = sb.toString().split("\n"); for(int i = 0; i < dt.length; i++) { String[] dataLine = dt[i].toString().split("\\s+"); if(dataLine.length == 1) { GetBalance gb = new GetBalance(unionPay); System.out.println(String.format("¥%.2f", gb.getBalance(dataLine[0]))); }else { Withdraw wd = new Withdraw(unionPay,dataLine[0],dataLine[1],dataLine[2],Double.parseDouble(dataLine[3])); wd.withdraw(); } } } } class Bank { private String bankNO; private String bankName; private ArrayList<Account> accountList = new ArrayList<Account>(); private ArrayList<ATM> ATMList = new ArrayList<ATM>(); public Bank() { super(); // TODO Auto-generated constructor stub } public Bank(String bankNO, String bankName) { super(); this.bankNO = bankNO; this.bankName = bankName; } public String getBankNO() { return bankNO; } public void setBankNO(String bankNO) { this.bankNO = bankNO; } public String getBankName() { return bankName; } public void setBankName(String bankName) { this.bankName = bankName; } public void addAccount(Account account) { this.accountList.add(account); } public void removeAccount(Account account) { this.accountList.remove(account); } public void addATM(ATM aTM) { this.ATMList.add(aTM); } public void removeATM(ATM aTM) { this.ATMList.remove(aTM); } public ArrayList<Account> getAccountList() { return accountList; } public void setAccountList(ArrayList<Account> accountList) { this.accountList = accountList; } public ArrayList<ATM> getATMList() { return ATMList; } public void setATMList(ArrayList<ATM> aTMList) { ATMList = aTMList; } } class User { private String ID; private String name; private String Phone; ArrayList<Account> list = new ArrayList<Account>(); public User() { super(); // TODO Auto-generated constructor stub } public User(String iD, String name, String phone) { super(); ID = iD; this.name = name; Phone = phone; } public String getID() { return ID; } public void setID(String iD) { ID = iD; } public String getPhone() { return Phone; } public void setPhone(String phone) { Phone = phone; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void addAccount(Account account) { this.list.add(account); } public void removeAccount(Account account) { this.list.remove(account); } } class Account { private String accountNO; private double balance = 0; private User user = null; private Bank bank = null; private static ArrayList<Card> list = new ArrayList<Card>(); public Account() { super(); // TODO Auto-generated constructor stub } public Account(String accountNO, double balance, User user, Bank bank) { super(); this.accountNO = accountNO; this.balance = balance; this.user = user; this.bank = bank; } public void addCard(Card card) { list.add(card); } public void removeCard(Card card) { list.remove(card); } public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public String getAccountNO() { return accountNO; } public void setAccountNO(String accountNO) { this.accountNO = accountNO; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Bank getBank() { return bank; } public void setBank(Bank bank) { this.bank = bank; } public ArrayList<Card> getList() { return list; } public void setList(ArrayList<Card> list) { Account.list = list; } public static Account getAmountbyCardNO(String cardNO) { Iterator<Card> cardItr = Account.list.iterator(); Card card = null; while(cardItr.hasNext()) { card = cardItr.next(); if(card.getCardNO().equals(cardNO)) { return card.getAccount(); } } return null; } } class Card { private String cardNO; private String cardPassword; private Account account = null; public Card() { super(); // TODO Auto-generated constructor stub } public Card(String cardNO, String cardPassword, Account account) { super(); this.cardNO = cardNO; this.cardPassword = cardPassword; this.account = account; } public String getCardNO() { return cardNO; } public void setCardNO(String cardNO) { this.cardNO = cardNO; } public String getCardPassword() { return cardPassword; } public Account getAccount() { return account; } public void setAccount(Account account) { this.account = account; } public void setCardPassword(String cardPassword) { this.cardPassword = cardPassword; } public boolean checkCard() { Pattern p = Pattern.compile("\\d{16}+"); Matcher m = p.matcher(this.cardNO); return m.matches(); } public boolean checkPassword(String password) { return this.cardPassword.equals(password); } } class ATM { private String ATMID; private Bank bank = null; public ATM() { super(); // TODO Auto-generated constructor stub } public ATM(String aTMID, Bank bank) { super(); ATMID = aTMID; this.bank = bank; } public String getATMID() { return ATMID; } public void setATMID(String aTMID) { ATMID = aTMID; } public Bank getBank() { return bank; } public void setBank(Bank bank) { this.bank = bank; } } class Withdraw { private UnionPay unionPay; private String cardNO; private String cardPassword; private String ATMID; private double amount; public Withdraw() { super(); // TODO Auto-generated constructor stub } public Withdraw(UnionPay unionPay, String cardNO, String cardPassword, String aTMID, double amount) { super(); this.unionPay = unionPay; this.cardNO = cardNO; this.cardPassword = cardPassword; ATMID = aTMID; this.amount = amount; } public Withdraw(String cardNO, String cardPassword, String aTMID, double amount) { super(); this.cardNO = cardNO; this.cardPassword = cardPassword; ATMID = aTMID; this.amount = amount; } public void withdraw() { /** * 校验该卡是否存在 */ Card card = ValidateData.getCardbyCardNO(unionPay, cardNO); if(card == null) { System.out.println("Sorry,this card does not exist."); System.exit(0); } /** * 校验ATM是否存在 */ ATM aTM = ValidateData.getATMbyATMID(unionPay, ATMID); if(aTM == null) { System.out.println("Sorry,the ATM's id is wrong."); System.exit(0); } Account account = Account.getAmountbyCardNO(cardNO); double balance = account.getBalance(); /** * 校验卡密码是否正确 */ if(!card.getCardPassword().equals(cardPassword)) { System.out.println("Sorry,your password is wrong."); System.exit(0); } /** * 校验取款金额是否大于余额 */ if (amount > balance) { System.out.println("Sorry,your account balance is insufficient."); System.exit(0); } /** * 校验是否为跨行取款 */ if (account.getBank().getBankNO() != aTM.getBank().getBankNO()) { System.out.println("Sorry,cross-bank withdrawal is not supported."); System.exit(0); } account.setBalance(balance - amount);//取款更新余额操作 if(amount >= 0) { showResult(account,1); }else { showResult(account,0); } } public void showResult(Account account,int flag) { String type = ""; if(flag == 1) { type = "取款"; }else { type = "存款"; amount *= -1; } String userName = account.getUser().getName(); String bankName = account.getBank().getBankName(); System.out.println(userName + "在" + bankName + "的" + ATMID + "号ATM机上" + type + String.format("¥%.2f", amount)); System.out.println("当前余额为" + String.format("¥%.2f", account.getBalance())); } } class ValidateData { /** * 校验卡号是否存在 * @param unionPay * @param cardNO * @return */ public static Card getCardbyCardNO(UnionPay unionPay,String cardNO) { Card card = null; Iterator<Bank> bankItr = unionPay.getBankList().iterator(); while(bankItr.hasNext()) { ArrayList<Account> accountList = bankItr.next().getAccountList(); Iterator<Account> accountItr = accountList.iterator(); while(accountItr.hasNext()) { ArrayList<Card> cardList = accountItr.next().getList(); Iterator<Card> cardItr = cardList.iterator(); while(cardItr.hasNext()) { card = cardItr.next(); if(card.getCardNO().equals(cardNO)) { return card; } } } } return null; } /** * 校验ATM ID是否存在 * @param unionPay * @param ATMID * @return */ public static ATM getATMbyATMID(UnionPay unionPay,String ATMID) { Iterator<Bank> bankItr = unionPay.getBankList().iterator(); Bank bank = null; ATM aTM = null; while(bankItr.hasNext()) { bank = bankItr.next(); Iterator<ATM> aTMItr = bank.getATMList().iterator(); while(aTMItr.hasNext()) { aTM = aTMItr.next(); if(aTM.getATMID().equals(ATMID)) { return aTM; } } } return null; } } class UnionPay { private ArrayList<Bank> bankList = new ArrayList<Bank>(); public UnionPay() { super(); // TODO Auto-generated constructor stub } public UnionPay(ArrayList<Bank> bankList) { super(); this.bankList = bankList; } public ArrayList<Bank> getBankList() { return bankList; } public void setBankList(ArrayList<Bank> bankList) { this.bankList = bankList; } public void addBank(Bank bank) { this.bankList.add(bank); } public void removeBank(Bank bank) { this.bankList.remove(bank); } } class GetBalance { private UnionPay unionPay; public GetBalance() { super(); // TODO Auto-generated constructor stub } public GetBalance(UnionPay unionPay) { super(); this.unionPay = unionPay; } public double getBalance(String cardNO) { return ValidateData.getCardbyCardNO(unionPay, cardNO).getAccount().getBalance(); } }
设计ATM仿真系统,具体要求参见作业说明。 OO作业9-1题目说明.pdf
输入格式:
每一行输入一次业务操作,可以输入多行,最终以字符#终止。具体每种业务操作输入格式如下:
- 取款功能输入数据格式:
卡号 密码 ATM机编号 金额
(由一个或多个空格分隔) - 查询余额功能输入数据格式:
卡号
输出格式:
①输入错误处理
- 如果输入卡号不存在,则输出
Sorry,this card does not exist.
。 - 如果输入ATM机编号不存在,则输出
Sorry,the ATM's id is wrong.
。 - 如果输入银行卡密码错误,则输出
Sorry,your password is wrong.
。 - 如果输入取款金额大于账户余额,则输出
Sorry,your account balance is insufficient.
。
②取款业务输出
输出共两行,格式分别为:
业务:取款 [用户姓名]在[银行名称]的[ATM编号]上取款¥[金额]
当前余额为¥[金额]
其中,[]说明括起来的部分为输出属性或变量,金额均保留两位小数。
③查询余额业务输出
业务:查询余额 ¥[金额]
金额保留两位小数。
输入样例1:
在这里给出一组输入。例如:
6222081502001312390 88888888 06 500.00
#
输出样例1:
在这里给出相应的输出。例如:
业务:取款 张无忌在中国工商银行的06号ATM机上取款¥500.00
当前余额为¥9500.00
输入样例2:
在这里给出一组输入。例如:
6217000010041315709 88888888 06 3500.00
#
输出样例2:
在这里给出相应的输出。例如:
业务:取款 杨过在中国工商银行的06号ATM机上取款¥3500.00
当前余额为¥6395.00
输入样例3:
在这里给出一组输入。例如:
6217000010041315715
#
输出样例3:
在这里给出相应的输出。例如:
业务:查询余额 ¥10000.00
输入样例4:
在这里给出一组输入。例如:
6222081502001312390 88888888 01 500.00
6222081502051320786 88888888 06 1200.00
6217000010041315715 88888888 02 1500.00
6217000010041315709 88888888 02 3500.00
6217000010041315715
#
输出样例4:
在这里给出相应的输出。例如:
业务:取款 张无忌在中国建设银行的01号ATM机上取款¥500.00
当前余额为¥9490.00
业务:取款 韦小宝在中国工商银行的06号ATM机上取款¥1200.00
当前余额为¥8800.00
业务:取款 杨过在中国建设银行的02号ATM机上取款¥1500.00
当前余额为¥8500.00
业务:取款 杨过在中国建设银行的02号ATM机上取款¥3500.00
当前余额为¥5000.00
业务:查询余额 ¥5000.00
输入样例5:
在这里给出一组输入。例如:
6640000010045442002 88888888 09 3000
6640000010045442002 88888888 06 8000
6640000010045442003 88888888 01 10000
6640000010045442002
#
输出样例5:
在这里给出相应的输出。例如:
业务:取款 张三丰在中国农业银行的09号ATM机上取款¥3000.00
当前余额为¥6880.00
业务:取款 张三丰在中国工商银行的06号ATM机上取款¥8000.00
当前余额为¥-1416.00
业务:取款 张三丰在中国建设银行的01号ATM机上取款¥10000.00
当前余额为¥-11916.00
业务:查询余额 ¥-11916.00
System.out.println("业务:"+type+" " + userName + "在" + bankName + "的" + ATMID + "号ATM机上" + type + String.format("¥%.2f", amount)); System.out.println("当前余额为" + String.format("¥%.2f", account.getBalance()));
总结:
这次的blog题目集总结归纳,总体来说,完成的还是可以的。在PTA上完成了习题后,过了几天,我又忘记了很多东西,经过这次总结归纳,我又想起了一部分知识,首先就是正则表达式,还是要多练多记,加以巩固;其次就是类图,类图还是有地方看不懂,接下来还是要重点去复习一下类图的关系,继承和多态也是要复习的。
实验这种东西,能够反映出哪里没掌握,哪里出错。还是要多练习了,但是如果知识不牢固,没学好,那实验做起来还是好难的啊。