|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: |
import java.io.*;
import java.util.Formatter;
import java.text.*;
import java.util.Arrays;
import java.io.IOException;
public class LoanArray // name the class file
{
public static void main(String[] args)throws IOException // Method Main runs program with exceptions
{
double[] totalYears = {7,15,30}; // set array for number of years for term of loan
Formatter fmt = new Formatter(); //interpreter for printf-style strings
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader bfr = new BufferedReader(isr);
for (int i=0;i<totalYears.length;i++){
int[] termMonths = {(7*12), (15*12), (30*12)}; // set array for number of months for term of loan
double []terms = {84,180,360};
double[] interestPaid = {(5.75/1200), (5.5/1200), (5.35/1200)}; //set array for interest paid
double[] interestPaidRate = {5.75, 5.5, 5.35}; // set array for annual interest paid rate
double totalPrincipal = 200000; // set total principal
double moPayment = 0; // set all fields to zero
double newBal = totalPrincipal; // balance after each moPayment
double newPrinc;// Amount paid on principal
double newinterestPaid; //Amount paid on interestPaid
String ssetprinc = "200,000";
//Calculate Monthly Loan moPayment
moPayment = (totalPrincipal * interestPaid[i]) / (1.0 - (Math.pow((1.0 + interestPaid[i]), - termMonths[i])));// increases the amount based on number on months
//Screen Output Summary Displays to Dos command window
System.out.printf("\nMortgage Payment Calculator\t version: 1.3\n\n"); //Program title and version
System.out.printf(" Total Loan Amount:$ %s\n\n",ssetprinc);
System.out.printf(" Interest Rate: %.2f\n\n",interestPaidRate[i]);
System.out.printf(" Total Years of Loan: %4.0f\n\n",totalYears[i]);
System.out.printf(" Monthly Payment:$ %.2f \n\n",moPayment);
System.out.printf(" **********************************************************\n");
//Screen Output Header for Amortization
System.out.printf("No.\t"); // Shows what moPayment number it is
System.out.printf("Interest Paid\t ");//Shows how much was applied to interestPaid
System.out.printf("Principal Paid\t");//Shows how much was applied to principal
System.out.printf(" Loan Balance \n\n");
System.out.println("Press Enter to View next 12 Months");
bfr.readLine();
//Display Amortization Schedule by month times number of years
for (i=0;i<terms.length;i++) { //Problem getting 12 payments to display
{
newinterestPaid = (newBal * interestPaid[i]);
newPrinc = (moPayment - newinterestPaid);// Amount paid on principal
newBal = (newBal - newPrinc); //Revise incremental balance on interestPaid
if (termMonths[i] == totalYears.length * 12 - 1) { // prevent negative values
moPayment = 0;
}
if (termMonths[i] % 12 == 0 && termMonths[i] != 0) { //Waits for keypress to show next 12 months
System.out.println("Press Enter to View next 12 Months");
bfr.readLine();
}
System.out.printf("%s\t",termMonths[i] + 1); // Display the Payment Number
//System.out.println((termMonths[i] + 1) + " \t"); // Displays the Payment number
System.out.printf("%10.2f\t",newinterestPaid);//Shows the interestPaid amount
System.out.printf("%10.2f\t",newPrinc);//Shows the amount used to pay down debt
System.out.printf(" %10.2f\n\n",newBal);//Displays the Amount Left to pay
}
}
}
}
}
|
Advertisement
| Hall of Fame |