Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Scanner;
- import java.io.*;
- import main.Grindjuoste;
- public class Main {
- public static void main(String[] args) throws FileNotFoundException {
- ArrayList<Grindjuoste> Grind = new ArrayList();
- Scanner sc = null;
- try {
- sc = new Scanner(new File("data.txt"));
- String code = null;
- String xa = null;
- while (sc.hasNextLine()) {
- String line = sc.next();
- if (line.trim().endsWith(":")) {
- code = line;
- // System.out.println(code);
- }
- String pav = sc.next();
- String toliau = sc.next();
- double skaicius = 0;
- while (true){
- try {
- skaicius = Double.parseDouble(toliau);
- toliau = sc.next();
- break;
- }
- catch(Exception r){
- pav=pav+" "+toliau;
- toliau=sc.next();
- }
- }
- // System.out.println(pav);
- double ilg = skaicius;
- toliau=sc.next();
- double plot = Double.parseDouble(toliau);
- toliau=sc.next();
- toliau=sc.next();
- double aukst = Double.parseDouble(toliau);
- toliau=sc.next();
- double kaina = Double.parseDouble(toliau);
- System.out.println(code+" "+pav+" "+ilg+" "+plot+" "+aukst+" "+kaina);
- //System.out.println(code);
- // Grind.add(code, pav, ilg, plot, aukst, kaina);
- }
- } catch(
- Exception e)
- {
- e.printStackTrace();
- } finally
- {
- if (sc != null) {
- sc.close();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement