import java.text.NumberFormat;
public class Mortgage {
public static void main(String[] args) {
int p = 1000000;
NumberFormat percent = NumberFormat.getPercentInstance();
double r = Double.parseDouble(percent.format(3.92*12));
int t = (int)(r);
double n;
n = Math.pow(30,12);
int f = (int) Math.floor(n);
int a =(1+t)^f;
int b = (a-1);
int c = (t*a)/b;
int m = p*c;
NumberFormat currency = NumberFormat.getCurrencyInstance();
String result = currency.format(m);
System.out.println(result);
}
}
I have tried to changed r
to int
but I still got exception. What am I not writing correctly?