I am working on a homework assignment that states:
Quote
* Write the program in Java (with a graphical user interface) and have it calculate
* and display the mortgage payment amount from user input of the amount of the mortgage
* and the user's selection from a menu of available mortgage loans:
*
* - 7 years at 5.35%
* - 15 years at 5.5%
* - 30 years at 5.75%
*
* Use an array for the mortgage data for the different loans. Display the mortgage payment
* amount followed by the loan balance and interest paid for each payment over the term of
* the loan. Allow the user to loop back and enter a new amount and make a new selection or
* quit. Please insert comments in the program to document the program.
* and display the mortgage payment amount from user input of the amount of the mortgage
* and the user's selection from a menu of available mortgage loans:
*
* - 7 years at 5.35%
* - 15 years at 5.5%
* - 30 years at 5.75%
*
* Use an array for the mortgage data for the different loans. Display the mortgage payment
* amount followed by the loan balance and interest paid for each payment over the term of
* the loan. Allow the user to loop back and enter a new amount and make a new selection or
* quit. Please insert comments in the program to document the program.
I was wondering what would be better served for calculating this issue? Can (or even should) I use a multi-dimensional array to pull the year and the rate, or should I use two arrays to pull the information. Currently here is what I have:
//establish the array
double[][] ratesArray = {{7, 15, 30}, {5.35, 5.5, 5.75}};
double amountPayment = ((loanAmount *(ratesArray[dropBoxCount][dropBoxCount] / 12)) / (1 - (Math.pow((1 + (ratesArray[dropBoxCount][dropBoxCount] / 12)), ((ratesArray[dropBoxCount][dropBoxCount] * 12) * -1)))));
What I'm trying do do in the equation is pull "just" the second value of the array. Should I try to set a variable just to represent that value in the equation (if so, how), or is there a way to pull it directly from the array?
Thank you for any help.

New Topic/Question
Reply




MultiQuote






|