Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package cassone;
- import java.io.*;
- import java.util.*;
- public class Cassone {
- static double kmToMill(double km) {
- double mill = km * 1.6;
- return mill;
- }
- public static void main(String[] args) {
- try {
- RandomAccessFile fileKi = new RandomAccessFile("szamok.txt", "rw");
- Scanner bill = new Scanner(System.in);
- while (true) {
- double szam = bill.nextDouble();
- if(szam == -1)
- break;
- System.out.println(kmToMill(szam) + "\n");
- fileKi.writeBytes(kmToMill(szam) + "\n");
- }
- fileKi.close();
- } catch(IOException e){
- System.err.println(e);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment