I've been reading this book and it had this code.
27 double totalPayment = monthlyPayment * numberOfYears * 12;
28
29 // Display results
30 System.out.println("The monthly payment is $" +
31 (int)(monthlyPayment * 100) / 100.0);
32 System.out.println("The total payment is $" +
33 (int)(totalPayment * 100) / 100.0);
34 }
35 }
I just don't understand what is the purpose of the (int) in S.O.P
I mean the value itself is double, doesn't that satisfy it ?
EXAMPLES* of some cases to where these can be applied ?
Thank you in advance!