As Ray suggests, just use a float. That's what I get for cutting and pasting
code. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2604 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -78,7 +78,7 @@ public class CurrencyTool
|
||||
*/
|
||||
public String penniesToDollars (int pennies)
|
||||
{
|
||||
float decimal = (float)(pennies / 100.0);
|
||||
float decimal = pennies / 100f;
|
||||
// if the pennies is a whole number of dollars, then we return just the string number
|
||||
if (pennies % 100 == 0) {
|
||||
return String.format("%.0f", decimal);
|
||||
|
||||
Reference in New Issue
Block a user