0
How can I get my mortgage in dollar amount?
Scanner kb = new Scanner(System.in); // System.out.println("Enter Principal: \n"); p = kb.nextInt(); // System.out.print("Enter APR: \n"); double AnnualRate = kb.nextDouble(); r = AnnualRate / 100 / 12; // System.out.print("Enter years: \n"); n = kb.nextInt(); double numeratorRate = r * (1 + r); numerator = Math.pow(numeratorRate, n); denominator = Math.pow(1+r, n-1); double m = p * (numerator / denominator); System.out.println(m * 100); kb.close();
1 Odpowiedź
+ 1
You entered principal in dollars?