Hello all,
I am having some issues rounding a decimal in my code. My program is running and doing what I would like otherwise. Here is what I have so far:
public class MortCalc2
{
public static void main(String [] args)
{
//Declare and initialize three variables
double numloanamt = 200000.00; //loan amount of 200k
double numinterest = 0.0575; //interest rate of 5.75%
int numtermyrs = 30; //term of 30 years
int numtermmths = 360; //term of 360 months
double numwholeamt = 545000.00; //loan amount + interest
double numpayment = 0; //monthly payment
numpayment = numwholeamt/numtermmths; //payment equals loan amount plus interest divided by the total term in months
System.out.println("Your monthly payment is $" + numpayment);
}
}
I am getting the results I want with the calculation except they are coming out as 1513.888888888889. I would like to see 1513.89. Can someone point me in the right direction. Thank you in advance for any help you can provide.
Thanks,
Seawall