Project- Payment Schedule (code not working.....)

Pls Help me!!!

 package com.codewithmosh;

import java.text.NumberFormat;
import java.util.Scanner;

public class Main {
final static byte MONTH_IN_YEAR = 12;
final static byte PERCENT = 100;
public static void main(String[] args) {
   int principal=(int)readNumber("Principal: ",1000 , 1000000);
   float annualInterest=(float)readNumber("Annual Interest rate: ",1 , 30 );
   byte years=(byte)readNumber("Period(Years): " , 1 , 30 );
    printMortgage(principal, years, annualInterest);
    printPaymentDetails(principal, years, annualInterest);
}

public static void printMortgage(int principal, byte years, float annualInterest) {
    double monthlyPayment=calculateMortgage(principal, annualInterest, years);
    System.out.println("MORTGAGE");
    System.out.println("--------");
    System.out.println("Monthly Payments = "+ NumberFormat.getCurrencyInstance().format(monthlyPayment));
}


public static void printPaymentDetails(int principal, byte years, float annualInterest) {
    System.out.println("Payment Schedule");
    System.out.println("----------------");
    for(double month = 1; month<= years *MONTH_IN_YEAR; month++) {
        double balance = calculateBalance(principal, annualInterest, years, month);
        System.out.println(NumberFormat.getCurrencyInstance().format(balance));
    }
}

public static double readNumber(String prompt , double min , double max){
    Scanner scanner = new Scanner(System.in);
    float value= 0;
    while(true){
        System.out.println(prompt);
        value= scanner.nextFloat();
        if(value>=min && value<=max)
            break;
        System.out.println("Enter a value greater than "+min+" and less than "+max);
    }
    return value;
}
public static double calculateMortgage(int principal , float annualInterest , byte years){

    double monthlyInterest= annualInterest / PERCENT / MONTH_IN_YEAR;
    short numberOfPayment= (short) (years  * 12);
    double monthlyPayment;
    monthlyPayment = principal * ( monthlyInterest * Math.pow ( 1 + monthlyInterest ,numberOfPayment ) /
            Math.pow ( 1 + monthlyInterest , numberOfPayment )-1 );
    return monthlyPayment;
}
public static double calculateBalance(int principal , float annualInterest , byte years, double numberOfPaymentsMade){
    double monthlyInterest= annualInterest / PERCENT / MONTH_IN_YEAR;
    short numberOfPayment= (short) (years  * 12);
    double balance = principal * (Math.pow(1+monthlyInterest,numberOfPayment)-Math.pow(1+monthlyInterest,numberOfPaymentsMade)/Math.pow(1+monthlyInterest,numberOfPayment)-1);
    return balance;
}

}`

output:
180000
Annual Interest rate: 
4
Period(Years): 
10
MORTGAGE
--------
Monthly Payments = -₹179,400.00
Payment Schedule
----------------
-₹32,790.48
-₹33,194.28
-₹33,599.43
-₹34,005.92
-₹34,413.78
-₹34,822.99
-₹35,233.57
-₹35,645.51
-₹36,058.83
-₹36,473.52
-₹36,889.60
-₹37,307.07
-₹37,725.92
-₹38,146.18
-₹38,567.83
-₹38,990.89
-₹39,415.36
-₹39,841.24
-₹40,268.55
-₹40,697.27
-₹41,127.43
-₹41,559.02
-₹41,992.05
-₹42,426.52
-₹42,862.45
-₹43,299.82
-₹43,738.65
-₹44,178.95
-₹44,620.71
-₹45,063.95
-₹45,508.66
-₹45,954.85
-₹46,402.54
-₹46,851.71
-₹47,302.38
-₹47,754.56
-₹48,208.24
-₹48,663.43
-₹49,120.14
-₹49,578.38
-₹50,038.14
-₹50,499.43
-₹50,962.26
-₹51,426.64
-₹51,892.56
-₹52,360.03
-₹52,829.07
-₹53,299.66
-₹53,771.83
-₹54,245.57
-₹54,720.88
-₹55,197.79
-₹55,676.28
-₹56,156.37
-₹56,638.05
-₹57,121.35
-₹57,606.25
-₹58,092.77
-₹58,580.91
-₹59,070.68
-₹59,562.08
-₹60,055.12
-₹60,549.81
-₹61,046.14
-₹61,544.13
-₹62,043.77
-₹62,545.08
-₹63,048.07
-₹63,552.73
-₹64,059.07
-₹64,567.10
-₹65,076.82
-₹65,588.25
-₹66,101.37
-₹66,616.21
-₹67,132.76
-₹67,651.04
-₹68,171.04
-₹68,692.78
-₹69,216.25
-₹69,741.47
-₹70,268.45
-₹70,797.17
-₹71,327.66
-₹71,859.92
-₹72,393.95
-₹72,929.77
-₹73,467.37
-₹74,006.76
-₹74,547.95
-₹75,090.94
-₹75,635.74
-₹76,182.36
-₹76,730.80
-₹77,281.07
-₹77,833.17
-₹78,387.12
-₹78,942.91
-₹79,500.55
-₹80,060.05
-₹80,621.42
-₹81,184.65
-₹81,749.77
-₹82,316.77
-₹82,885.66
-₹83,456.44
-₹84,029.13
-₹84,603.73
-₹85,180.24
-₹85,758.67
-₹86,339.03
-₹86,921.33
-₹87,505.57
-₹88,091.75
-₹88,679.89
-₹89,269.99
-₹89,862.06
-₹90,456.10
-₹91,052.12
-₹91,650.12

Process finished with exit code 0
Why am i getting negative value??

you divided on -1 that is probably why

Can you pls look at this code!!!

package com.codewithmosh;

import java.text.NumberFormat;
import java.util.Scanner;

public class Main {
    final static byte MONTH_IN_YEAR = 12;
    final static byte PERCENT = 100;
    public static void main(String[] args) {
        int principal=(int)readNumber("Principal: ",1000 , 1000000);
        float annualInterest=(float)readNumber("Annual Interest rate: ",1 , 30 );
        byte years=(byte)readNumber("Period(Years): " , 1 , 30 );
        printMortgage(principal, years, annualInterest);
        printPaymentDetails(principal, years, annualInterest);
    }

    public static void printMortgage(int principal, byte years, float annualInterest) {
        double monthlyPayment=calculateMortgage(principal, annualInterest, years);
        System.out.println("MORTGAGE");
        System.out.println("--------");
        System.out.println("Monthly Payments = "+ NumberFormat.getCurrencyInstance().format(monthlyPayment));
    }


    public static void printPaymentDetails(int principal, byte years, float annualInterest) {
        System.out.println("Payment Schedule");
        System.out.println("----------------");
        for(double month = 1; month<= years *MONTH_IN_YEAR; month++) {
            double balance = calculateBalance(principal, annualInterest, years, month);
            System.out.println(NumberFormat.getCurrencyInstance().format(balance));
        }
    }

    public static double readNumber(String prompt , double min , double max){
        Scanner scanner = new Scanner(System.in);
        float value= 0;
        while(true){
            System.out.println(prompt);
            value= scanner.nextFloat();
            if(value>=min && value<=max)
                break;
            System.out.println("Enter a value greater than "+min+" and less than "+max);
        }
        return value;
    }
    public static double calculateMortgage(int principal , float annualInterest , byte years){

        double monthlyInterest= annualInterest / PERCENT / MONTH_IN_YEAR;
        short numberOfPayment= (short) (years  * 12);
        double monthlyPayment;
        monthlyPayment = principal * ( monthlyInterest * Math.pow ( 1 + monthlyInterest ,numberOfPayment ) /
                (Math.pow ( 1 + monthlyInterest , numberOfPayment )-1) );
        return monthlyPayment;
    }
    public static double calculateBalance(int principal , float annualInterest , byte years, double numberOfPaymentsMade){
        double monthlyInterest= annualInterest / PERCENT / MONTH_IN_YEAR;
        short numberOfPayment= (short) (years  * 12);
        double balance = principal * (Math.pow(1+monthlyInterest,numberOfPayment)-Math.pow(1+monthlyInterest,numberOfPaymentsMade)/(Math.pow(1+monthlyInterest,numberOfPayment)-1));
        return balance;
    }

}

Principal:
1000000
Annual Interest rate:
3.92
Period(Years):
10
MORTGAGE

Monthly Payments = ₹10,086.54
Payment Schedule

-₹615,542.53
-₹622,384.68
-₹629,249.18
-₹636,136.10
-₹643,045.52
-₹649,977.51
-₹656,932.15
-₹663,909.50
-₹670,909.65
-₹677,932.66
-₹684,978.62
-₹692,047.59
-₹699,139.66
-₹706,254.89
-₹713,393.36
-₹720,555.16
-₹727,740.35
-₹734,949.01
-₹742,181.22
-₹749,437.05
-₹756,716.59
-₹764,019.90
-₹771,347.08
-₹778,698.19
-₹786,073.31
-₹793,472.53
-₹800,895.91
-₹808,343.55
-₹815,815.51
-₹823,311.89
-₹830,832.75
-₹838,378.18
-₹845,948.26
-₹853,543.06
-₹861,162.68
-₹868,807.19
-₹876,476.67
-₹884,171.20
-₹891,890.87
-₹899,635.75
-₹907,405.94
-₹915,201.51
-₹923,022.54
-₹930,869.13
-₹938,741.34
-₹946,639.27
-₹954,563.00
-₹962,512.62
-₹970,488.20
-₹978,489.84
-₹986,517.61
-₹994,571.61
-₹1,002,651.92
-₹1,010,758.63
-₹1,018,891.82
-₹1,027,051.57
-₹1,035,237.98
-₹1,043,451.14
-₹1,051,691.12
-₹1,059,958.02
-₹1,068,251.93
-₹1,076,572.93
-₹1,084,921.11
-₹1,093,296.56
-₹1,101,699.37
-₹1,110,129.63
-₹1,118,587.43
-₹1,127,072.86
-₹1,135,586.00
-₹1,144,126.96
-₹1,152,695.82
-₹1,161,292.67
-₹1,169,917.60
-₹1,178,570.71
-₹1,187,252.08
-₹1,195,961.81
-₹1,204,700.00
-₹1,213,466.73
-₹1,222,262.09
-₹1,231,086.19
-₹1,239,939.12
-₹1,248,820.96
-₹1,257,731.82
-₹1,266,671.78
-₹1,275,640.95
-₹1,284,639.42
-₹1,293,667.29
-₹1,302,724.65
-₹1,311,811.59
-₹1,320,928.22
-₹1,330,074.62
-₹1,339,250.91
-₹1,348,457.17
-₹1,357,693.51
-₹1,366,960.02
-₹1,376,256.79
-₹1,385,583.94
-₹1,394,941.56
-₹1,404,329.74
-₹1,413,748.60
-₹1,423,198.22
-₹1,432,678.71
-₹1,442,190.17
-₹1,451,732.70
-₹1,461,306.40
-₹1,470,911.38
-₹1,480,547.73
-₹1,490,215.56
-₹1,499,914.98
-₹1,509,646.08
-₹1,519,408.96
-₹1,529,203.74
-₹1,539,030.52
-₹1,548,889.39
-₹1,558,780.47
-₹1,568,703.87
-₹1,578,659.67
-₹1,588,648.00
-₹1,598,668.96
-₹1,608,722.66

Process finished with exit code 0

Can you send your code? pls!!

guess it should be like this

Did it work for you?
Actually do you know the formulae to calculate Mortgage?