import java.io.*;
public class Amortization {
public static void main (String[] args)throws IOException {
BufferedReader dataIn=new BufferedReader (new InputStreamReader (System.in));
double loanamount=0.0, interestrate=0.0, numberofyears=0.0,amortization=0.0, a=(1+interestrate),b=numberofyears ;
String TextInput;
System.out.print ("Input the loan amount: ") ;
TextInput=dataIn.readLine () ;
loanamount=Integer.parseInt (TextInput) ;
TextInput=dataIn.readLine () ;
System.out.print ("Input the interest rate: ") ;
TextInput=dataIn.readLine () ;
interestrate=Integer.parseInt (TextInput) ;
TextInput=dataIn.readLine () ;
System.out.print ("Input the number of years: ") ;
TextInput=dataIn.readLine () ;
numberofyears=Integer.parseInt (TextInput) ;
TextInput=dataIn.readLine () ;
amortization=loanamount*(interestrate*(1+interestrate)^numberofyears)/(1+interestrate)^numberofyears-1;
System.out.println ("Monthly Amortization is: "+amortization) ;
}
}
I don't know how to put 'number of years' in exponent form. The user has to input loan amount, interest rate, and number of years.
I'm really new to this, so please bear with me. thanks guys!