This is a little code I made to convert a given number of euros (3772,46 in this case) to portuguese 'escudos'.
I would like to make the primitive type convertion more elegant.
Since the 'escudo' lost its fractional value, I think that some floor/ceiling thing it's probably needed here.
(Yeah, this is a 4 years-old programming exercise, made when the Euro was dandy...)
Thank you, programmers.
Name:
Anonymous2007-01-17 11:16
There is no such thing as elegance in Java, only scalable web 2.0 enterprise cluster
The J2SE 5 solution is better. It allows you to keep the precision internally and then round directly on the BigDecimal.
You can also set the rounding rules using a MathContext, something you can't really do elegantly in J2SE 1.4.2.
[You could use BigDecimal in the J2SE 1.4.2 solution but you would still need to convert back to the float primitive type before rounding.... nasty. No wonder they improved BigDecimal]
>>1
your code is beautiful, I learned volumes from it
Name:
Anonymous2008-01-26 6:16
Estúpido!
Nessa altura bastava ir ao google e meter: 3772.46 PTE in EUR
Agora já não dá mas podes ver que o dólar é merda* com: 1 EUR in USD
ou 1 € in $
*dólar é merda = dollar is shit
Name:
Anonymous2008-01-26 6:19
IT'S CONVERSION
Name:
Anonymous2008-01-26 7:04
IT'S CONVERTHE GAMEION
Name:
Anonymous2008-01-26 7:22
CONVERTION
I lol'd
Name:
Anonymous2008-01-26 7:55
Do it like a nigger would, just wget a request to Google and sed the answer.
Name:
Anonymous2008-01-26 10:18
Yeah, this is a 4 years-old programming exercise
If it's meant for 4 year olds, why are you having so much trouble with it?