Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java Primitive Type Conversion Elegance

Name: Cup.Of.Joe 2007-01-16 16:40

Dear programmers,

public class Convertion {

  public static void main(String[] args) {

    final float CONVERTION_RATE = 200.482F;
    float given_number = 3772.46F;

    System.out.println("€" + given_number + " = " +
                      (int)(given_number * CONVERTION_RATE) + " Escudos");
  }
}

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: Anonymous 2007-01-19 5:10

When something is 2 metres long (or 2 Koala noses, or whatever retarded measure Americans have), do you say "m 2" or "2 m"?

When you say something is "2 metres", do say "it's two metres" or "it's metres two"?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List