BabyNames.java.html

  1  import java.io.File;
  2  import java.io.FileNotFoundException;
  3  import java.util.Scanner;
  4  
  5  public class BabyNames
  6  {
  7     public static final double LIMIT = 50;
  8  
  9     public static void main(String[] args) throws FileNotFoundException
 10     {  
 11        Scanner in = new Scanner(new File("babynames.txt"));
 12           
 13        RecordReader boys = new RecordReader(LIMIT);
 14        RecordReader girls = new RecordReader(LIMIT);
 15        
 16        while (boys.hasMore() || girls.hasMore())
 17        {
 18           int rank = in.nextInt();
 19           System.out.print(rank + " ");
 20           boys.process(in);
 21           girls.process(in);
 22           System.out.println();
 23        }
 24  
 25        in.close();
 26     }
 27  }