I would use an int (whether cents or tenth of cent if you are in the oil
business depends on your application). No rounding problems, no parsing
problems.

Martin

> -----Ursprüngliche Nachricht-----
> Von: Murray Collingwood [mailto:[EMAIL PROTECTED] 
> Gesendet: Freitag, 9. September 2005 09:15
> An: user@struts.apache.org
> Betreff: A nice easy question
> 
> 
> Hi all
> 
> I put a price field (float) in a form (textbox) but had some 
> trouble parsing the text using 
> the DemicalFormat class (it doesn't seem to like the 'float' 
> type).  So I went through 
> changing my field to 'int' but now of course I can only store 
> whole dollar amounts.
> 
> To save me lots of time, should I:
> 
> a) use long
> b) use double
> c) go back to float and fix my parsing
> d) use int and store the value as cents (rather than dollars) 
> (n*100 and n/100)
> 
> Kind regards
> mc
> 
> 
> FOCUS Computing
> Mob: 0415 24 26 24
> [EMAIL PROTECTED]
> http://www.focus-computing.com.au
> 
> 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.10.19/93 - Release 
> Date: 8/09/2005
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to