smgr

cassone

Jan 17th, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. package cassone;
  2.  
  3. import java.io.*;
  4. import java.util.*;
  5.  
  6. public class Cassone {
  7.  
  8.     static double kmToMill(double km) {
  9.         double mill = km * 1.6;
  10.         return mill;
  11.     }
  12.  
  13.     public static void main(String[] args) {
  14.  
  15.  
  16.         try {
  17.             RandomAccessFile fileKi = new RandomAccessFile("szamok.txt", "rw");
  18.             Scanner bill = new Scanner(System.in);
  19.             while (true) {
  20.                 double szam = bill.nextDouble();
  21.                 if(szam == -1)
  22.                     break;
  23.                 System.out.println(kmToMill(szam) + "\n");
  24.                 fileKi.writeBytes(kmToMill(szam) + "\n");
  25.             }
  26.             fileKi.close();
  27.         } catch(IOException e){
  28.             System.err.println(e);
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment