1 import java.io.*;
2
7 class Matka {
8 static final double MITTAKAAVA = 200000.0;
9 static final double MM_KM = 1000.0*1000.0;
10
11 public static void main(String[] args) {
12 int matka_mm;
13 double matka_km;
14
15 System.out.println("Lasken 1:" + MITTAKAAVA +
17 " kartalta millimetreinä mitatun matkan");
18 System.out.println("kilometreinä luonnossa.");
19
20 System.out.print("Anna matka millimetreinä>");
22
23 BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
24 String s = "";
25 try {
26 s = in.readLine();
27 } catch (IOException ex) {
28 }
29 if ( s == null ) return;
30 if ( s.equals("") ) return;
31 matka_mm = Integer.parseInt(s);
32
33 matka_km = matka_mm*MITTAKAAVA/MM_KM;
35
36 System.out.println("Matka on luonnossa " + matka_km + " km.");
38 }
39 }
40
41