Double converts to NaN - Java

Saturday, May 3, 2014

I'm writing a mortgage calculator app. I have initialized doubles purchPrice, downPay, and interestRate. All three doubles are initialized to 0.0. I have three payment options tenPay, twentyPay, and thirtyPay, all initialized to 0.0. After the following lines of code are ran, tenPay becomes NaN, and the other two are 0.0 as expected. I can't figure out why this is happening and would love another set of eyes on it.



tenPay = ((purchPrice - downPay) * (interestRate * .01) / (10/12));
twentyPay = ((purchPrice - downPay) * (interestRate * .01) / (20/12));
thirtyPay = ((purchPrice - downPay) * (interestRate * .01) / (30/12));


I'm pretty sure my math is faulty, please disregard.







http://ift.tt/1oeuB7H