Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch5ex13;
- import java.util.Scanner;
- public class Ch5Ex13
- {
- public static void main(String[] args)
- {
- Scanner sc=new Scanner(System.in);
- System.out.print("Principal: ");
- double p=sc.nextDouble();
- System.out.print("Interest Rate: ");
- double r=sc.nextDouble();
- System.out.print("Number of Monthly Payments: ");
- int m=sc.nextInt();
- double payment=((p*(r/12))/(1-(Math.pow(1+r/12,-m))));
- System.out.printf("The monthly payment is: $%.2f",payment);
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement