Advertisement
KeeganT

Ch5Ex13

Feb 15th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. package ch5ex13;
  2. import java.util.Scanner;
  3.  
  4. public class Ch5Ex13
  5. {
  6.     public static void main(String[] args)
  7.     {
  8.         Scanner sc=new Scanner(System.in);
  9.         System.out.print("Principal: ");
  10.         double p=sc.nextDouble();
  11.         System.out.print("Interest Rate: ");
  12.         double r=sc.nextDouble();
  13.         System.out.print("Number of Monthly Payments: ");
  14.         int m=sc.nextInt();
  15.         double payment=((p*(r/12))/(1-(Math.pow(1+r/12,-m))));
  16.         System.out.printf("The monthly payment is: $%.2f",payment);
  17.         System.out.println();
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement