Due date: Thursday, March 11, when labs close.
memo.txt
SelectionSort.java
Sort.java
Bank.java
Eratosthenes.java
For more array practice, look at ArrayDemo2.java and ArrayDemo2.java with line numbers.
When you close an account in a big bank you need to decide what happens with the old account's number. If the report is
account balance transaction count 0 $0 2 1 $100 3 2 $200 4 3 $300 5and you close account 2 should you see
account balance transaction count 0 $0 2 1 $100 3 3 $300 5or
account balance transaction count 0 $0 2 1 $100 3 2 $300 5
The first one would be better for a real bank. The owner of account 3 would be very surprised if her account number changed just because someone else closed an account.
But the second one is easier to program using the ArrayList API, and we are just beginning programmers.
You can do whichever you like for full credit on the homework - just make sure to discuss your choice in your memo.
Closing an account should not count as a transaction, and the transaction count of the closed account should be subtracted from the Bank's transaction count (just as the balance is). (The answers might be different for a real bank, but we want to keep ours simple.)
JOI says that the banker should be the one to close the account. But when I thought that through in response to Ricardo's question below I decided that it would be better if a customer closed his or her own account, after connecting to it in the usual way. So you should add a new customer transaction "close" to invoke the method public void close( BankAccount account ) The customer should see the message "We will send you a check for [balance in account]. "Thank you for banking with [name of Bank].Subject: closing an account Date: Tue, 9 Mar 2004 21:43:25 -0500 (EST) > From: a classmate > To: eb@cs.umb.edu > Subject: the method > Date: Tue, 09 Mar 2004 21:36:58 -0500 > > hello, > > if a user closes the account, should the program automaticly > getting him out from the user account or after when the user types > "quit"? Good question. The only thing that makes sense is to say that close really means close and quit. If not, the user could try to see the balance in the account he just closed, or make a deposit there.
Put a main method in your Eratosthenes class. main should expect a single integer on the command line, so
> java Eratosthenes 10should produce exactly the output shown in the text as an example. In fact, you can use the code in the text in the body of main. Just replace the 10 there by the number from the command line. (Remember Integer.parseInt(), discussed in class.)