Assignment Five
Java Objects and More Arrays

In this assignment you will utilize some system objects to rebuild the retirement calculator built in assignment three.

You will use the AccountInformation class which we built in class. Here is an example main which both creates AccountInformation objects, and uses the Date and formatter objects.

Part One

Recreate your retirement calculator function so that it returns an array of AccountInformation objects filled with each year's account information. This function will take four parameters and return an AccountInformation array.

Part Two

Create a function which prints out your array of retirement AccountInformation objects in a very neat chart. Your chart should have at least two columns: a date column and a balance column. You should use the GregorianCalendar object and the DateFormat object to neatly print out the dates for each year (for example, you could print out the last day of each year) and you should use the NumberFormat class to print out the value as a currency. This printing function should take one parameter and return void.

Part Three

Putting it together.

Create a function which runs a user-interface loop to run your retirement calculator.

What to turn in

Turn in your well-commented source code and a few sample runs of the program by e-mail before midnight of 15 March 2007. Late homeworks will lose points for their tardiness.

Extra challenge

Instead of asking the number of years until retirement, ask the user her/his birthday (using the DateFormat.parse() function to get a Date object to calculate with) and assume that they will retire on their 65th birthday. For yet more entertainment, calculate how long it is from today's date (create a new Date object with no parameters) until their birthday and calculate how much their initial balance will be on their next birthday before calling your retirement function, and then print out the chart with the balances on their birthday each year.