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 9:36 (sage)

>>9
Amerikans use Furlongs for measurements IIRC.

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