title: determine the periodic loan payment
body: <p>am not getting this program to display my instalments correctly can I please get some help thanks...... </p>
  
  <pre><code>package Loops;
  
  import java.util.Scanner;
  
  /**
   *
   * 
   */
  public class program {
  
      public static void main(String[] args) {
          Scanner input = new Scanner(System.in);
          //variabled decleared
          double rate;
          double payment;
          //input
          System.out.print("Enter Loan Amount:");
          double principal = input.nextDouble();
          System.out.print("Enter Annual Interest:");
          double interest = input.nextDouble();
          System.out.print("Total payments per year:");//12=monthly,4= quartely,2=semi-annually and 1=annually
          double period = input.nextDouble();
          System.out.print("Enter Loan Length :");
          int length = input.nextInt();
  
          //proces
          double n = period * length;
          rate = interest / 100;
          double monthly_rate = rate / period;
          payment = principal * (principal * (monthly_rate * Math.pow((1 + monthly_rate), n)));
  
          System.out.printf("Your Monthly sum is %.2f", payment);
  
  
      }
  }
  </code></pre>