title: Need help Java amortization table calculations
body: <p>This is my homework it is due Monday the 16th.
  I finally got the months to display right but the amounts are wrong.
  Also, not necessary but it would be nice to stop and Print something between each loan.
  Like loan 1, loan 2, loan 3...</p>
  
  <p>Any help will be appreciated</p>
  
  <pre><code>/*Write the program in Java (without a graphical user interface) 
  and have it calculate the payment amount for 3 mortgage loans:
  
   - 7 year at 5.35%
   - 15 year at 5.5%
   - 30 year at 5.75%
  
  Use an array for the different loans. 
  Display the mortgage payment amount for each loan 
  and then list the loan balance and interest paid for 
  each payment over the term of the loan. 
  Use loops to prevent lists from scrolling off the screen.*/
  </code></pre>
  
  <p>I have the months correct but the loan amounts are wrong.</p>
  
  <pre><code>    import java.io.IOException;      //Code that delays ending the program
  
  
     class MonthlyRhondav4
      {      
  
    public static void main ( String[] args) throws IOException{
  
       double loanAmount = 200000.00;   // $ amount borrowed
       double monthlyPayment = 0;   // monthly payment for calculating
       double loanBalance;
       double interestPaid;
       double principalPaid;
       int paymentCounter;
       int lineCounter = 0;
  
  
  
       java.text.DecimalFormat dcm = new java.text.DecimalFormat("$,###.00");                                      
  
  
       int termArray[] = {84, 180, 360};      // Different loan terms in months 
       double interestArray[] = {0.0535, 0.055, 0.0575};// Different interest rates for the loan
       int k =0;// gonna be paymentIndex
  
    /*Code to start the payment list*/   
  
       System.out.print("\n\nPlease Press Enter to Continue to the 3 Different    Amortization Lists");
       System.out.println ();
       System.out.println ();
  
       System.in.read();
       System.in.read();  
  
    /*Display columns*/    
  
       System.out.println("Month \t Loan Amount Left\tInterest\t\tPrincipal \n"); //Prints headers for columns
       System.out.println ();
  
  
    /*Loop to calculate and print monthly payments*/
  
       //for(k=0; k&lt;3; k++){// k is going to be paymentIndex to loop through index
  
       for (k = 0; k &lt; interestArray.length; k++) {
  
          for(paymentCounter =1; paymentCounter &lt;= termArray[k]; paymentCounter++)  // months through array
          { 
  
          /********TROUBLE HERE***************************************************************************************/
  
             monthlyPayment = ((loanAmount * (interestArray[k]) * termArray[k]) + loanAmount) / (termArray[k] * 12);
  
             interestPaid = loanAmount*(interestArray[k]/12);            //interest paid through array
  
             principalPaid = monthlyPayment-loanAmount*(interestArray[k]/12);       //principal paid
  
        /*need to fig monthly payment+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
  
  
  
  
             System.out.println(paymentCounter + "\t" + dcm.format(loanAmount) + "\t\t" + dcm.format(interestPaid) + "\t\t\t" + dcm.format(principalPaid));
  
  
  
             lineCounter++;                                //Increment the display counter
             if (lineCounter &gt; 11 &amp;&amp; paymentCounter &lt; termArray[k]*12) //Check to see if 12             
             {
  
                System.out.println ("Please Press Enter to Continue the List" ); //Code to delay ending the program
                System.in.read();
                System.in.read();
                lineCounter = 0; 
  
             }
  
          }
          loanAmount = (loanAmount - (monthlyPayment-loanAmount*(interestArray[k]/12))); //Calculate new loan amount
       }
  
  
    }//ends public static void main 
       }//ends public class 
  </code></pre>