Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- File file = new File("dane.txt");
- Scanner sc = new Scanner(file);
- while (sc.hasNextLine()) {
- String lin = sc.nextLine();
- System.out.println(lin);
- arr = lin.split("-");
- if (arr[3].contains("wies") && Integer.parseInt(arr[1]) >= 2) {
- Double cena = Double.parseDouble(arr[2]);
- cena = cena * 0.85;
- //arr[2] = Double.toString(cena);
- out.writeUTF(arr[0]);
- out.writeInt(Integer.parseInt(arr[1]));
- out.writeDouble(cena);
- out.writeUTF(arr[3]);
- }
- }
- out.close();
- sc.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement