This assignment may be done in Java or in Lisp (except item 2) .
The function bank should update a customer's bank balance by adding the amount of each update to it. The output should be a new sorted list of accounts with updated balances; make a new Account with the new information.
You will need to write the .compareTo() method for an Account to properly sort the updates. The first criterion for sorting is the name, which should be in alphabetic order. Within the same name, updates must be sorted by amount. In order to avoid falsely signaling overdrafts, the bank must process all deposits before any withdrawals. Therefore, any positive amount must be sorted before any negative amount. The bank also wants to sort the negative amounts so that the largest withdrawals (most negative amounts) are processed first, to cause the largest possible number of overdrafts and overdraft fees for the bank. (Yes, this is evil; but it is what the banks actually have been doing. http://www.huffingtonpost.com/2010/08/11/wells-fargo-overdraft-law_n_679178.html )
For each update that causes an overdraft, print a message stating so, with the name and final amount. Go ahead and update the account, making the account balance negative, and subtract 30 from the balance as an overdraft fee for each overdraft transaction.
If a name does not exist for an account and the total amount of all updates for that name is positive, create a new account for that name. Print a message that there is a new account, with a name and amount.
If a name does not exist for an account and the total amount of all updates for that name is zero or negative, print a message that there is no account and the name and amount, but otherwise ignore the update.
If a list is well-formed, return true; if there is a tag out of place, print a message with the offending tag, its numeric position in the list (starting with 0), and the correct tag that was expected, and return false.
An example of XML is: http://www.comptechdoc.org/independent/web/xml/guide/xmlexample.html