Assignment Four
This assignment is to modify Assignment Three
as follows:
· Write a method
void drawBalance(Graphics2D
g, BankAccount account);
that draws the Rectangle and the balance of the account
and call it from the action classes.
· Write a method
boolean isInputOK(String
input);
that check to make sure that the input string is either all digits or is in money format, 1 decimal place and exactly 2 digits after the decimal place like 100 or 100.00 or 250.55. Hint: use the tools (methods) indexOf and substring from the String class and isDigit from the Character class.
·
Draw the
balance in money format. Use the getCurrencyInstance() and format(double number) methods from the NumberFormat class. My version of Assignment Three, ATM2.java,
has an example.
The assignment is due on Wednesday June
9th at class time and there will be a quiz. Hand in the usual.