String phrase = "4556.44";
Float num = new Float(phrase);
int dollars = (int) Math.floor(num);
System.out.println(""+dollars);
int cent = (int) Math.floor((num - dollars) * 100.0F);
int cent2 = (int) ((num - dollars) * 100.0);
System.out.println(""+cent+":"+cent2);
This is a Number to Word Class Code Phrase, My Problem is when I run this code fragment the output result is 4556.43. But the input value is 4556.44. Please tell me why this is happened and I need the answer for correct this Problem.
1 Answer