## Part 1:

The following program is written in an entirely procedural fashion.

Not that it really matters, but in case you're not clear on the different schemes used in the program for labelling the squares on a chess board, here they are:

1. Rewrite this program in a properly object oriented fashion. Show your instructor when you are done.
2. Add a method "step(i)" that steps one square in the direction i, where i=0 means north, i=1 means east, i=2 means south, and i=3 means west, and modify main() so that each object does a step north and a step east prior to being printed. A step that takes you off the chessboard should result in a RuntimeException being vomited onto the terminal screen.
3. Add the ability to handle chess-board positions represented by one more system. In the new system, each square is assigned a unique number according to the following scheme: the lowest row is numbered left-to-right as 0,1,..,7, the next row up is numbered left-to-right as 8,9,...,15, and so on, up to the last row which is numbered 56,57,...,63. Modify main() so that array A has four elements, the last element being of this new kind of chess-board position.

## Part 2: The Setup

In this part you will write a program that provides a simple loan calculator with a GUI interface. Here's an example of what it might look like:

The idea here is that "loan amount", "rate" and "monthly payment" are inputs. The user enters or chooses values for them, then presses the calculate button, which causes the program to calculate values for "months to payoff" and "cost" and display them in the GUI.

The financial rules for this are simple:

1. At the end of each month, you accrue interest according to the formula interest = balance*rate/1200, where "rate" is assumed to be in percentage form, e.g. "5.25%".
2. At the end of each month, after the interest is accrued, the montly payment is made.
3. At the end of each month, after the interest is accrued and the monthly payment is made, if the balance is less than or equal to zero, the loan is considered to be "paid off", and any overpayment (the amount by which the balance is in the negatives) is repaid to the borrower.
4. The "cost" of the loan is given by the formula: cost = total amount paid - amount of overpayment repaid - original loan amount.

Here are a few examples:
• if amount = \$100.00, rate=5%, monthly payment = \$200.00, then after one month we accrue \$0.42 in interest. This leaves a new balance of \$100.42. The payment is \$200, leaving a balance of -99.58. So \$99.58 gets repaid, and the simulation is over. It lasted 1 month, and the cost was 200 - 99.58 - 100.0 = \$0.42.
• if amount = \$500.00, rate=6.75%, monthly payment = \$40.00, then months = 13 and cost is \$19.91.
NOTE: You are to use good object oriented design practices in creating this program!

## Part 2, Step 1

Write the code that creates the window with the GUI components, but without the code that reacts to the button push or does any of the financial calculations.

## Part 2, Step 2

Write the code to do the financial computations. Write it completely separately from the GUI - you should be able to run and test it from the command line, and it should have a nice interface for providing it with the inputs, and querying it from the outputs. Once again, at theis point the financial calculation code should have no connection to the GUI code.
Remember: Use good OOP practices!

## Part 2, Step 3

Now write the code to react to a button push by doing the financial calculations and displaying the output results in the GUI.
Remember: Use good OOP practices!