Chapter 6: ArrayLists and Generic Classes NOPE

January 14th, 2014

ArrayLists and Generic Classes

Classwork:
Write a class Customer with customer number, name, address, and balance.
Write a class Clients. Clients class has an ArrayList to keep all the customers information together. This class has the following methods:
1. add – this method adds a new customer to the ArrayList
2. remove – this method removes the customer from the ArrayList
3. update – this method changes a customer’s balance.
4. getTotal – this method finds the total of all the customers balances.
5. getMaxBal – this method finds the customer with the largest balance and returns the customer object.
6. print – this method prints all the customers information.
7. sortBalance – this method creates a new ArrayList with the customers sorted by balance. This methods prints the customers in sorted order.

Write a driver class to show all the methods above.
NOTE: use generics and for-each loops

Homework: Two questions posted on edmodo.com