class Example3
{
static final double KMS_PER_MILE = 1.609; //way of define constant
static final double YARD_PER_MILE = 1/1760.0;
public static void main(String args[])
{
double kilo;
int yards = 385;
int miles =26;
kilo = (((YARD_PER_MILE*yards)+miles)*KMS_PER_MILE);
System.out.println("Kilomters ="+kilo+"Km");
}
}
No comments:
Post a Comment