Find a subscriber

Report a typo

The call_stat.txt file contains information about mobile subscriber calls. It has the following structure: subscriber_id1 subscriber_id2 duration_sec.

Subscriber ids are Strings, duration is int. For example:

sub1 sub2 72
sub2 sub1 35

Find all the calls that lasted more than 60 seconds and print the corresponding subscriber_id1 to the console. The duration in the file is given in seconds.

Construct a program that solves the problem. Use < and > to adjust code indentation. Three closing curly brackets are collapsed inline for simplicity. No need to use indentation for them.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                if (duration > 60) {
              
                System.out.println(first);
              
                try (Scanner scanner = new Scanner(new File("call_stat.txt"))) {
              
                while (scanner.hasNext()) {
              
                String second = scanner.next();
              
                String first = scanner.next();
              
                int duration = scanner.nextInt();
              
                }}}
              
___

Create a free account to access the full topic