Advertisement
Guest User

Untitled

a guest
Mar 6th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. import java.io.File;
  2. import java.io.FileWriter;
  3. import java.io.PrintWriter;
  4. import java.util.Scanner;
  5.  
  6. /**
  7.  * Created by Bryan on 2/25/2015.
  8.  */
  9. public class A19005B
  10. {
  11.     public static void main(String[] args)throws Exception
  12.     {
  13.  
  14.  
  15.         //declare variables
  16.  
  17.         //open input file
  18.         File myFile = new File("data/FBIN.txt");
  19.         Scanner inputFile = new Scanner(myFile);
  20.  
  21.         //open output file
  22.         FileWriter fWriter = new FileWriter("data/output.txt", true);
  23.         PrintWriter outFile = new PrintWriter(fWriter);
  24.  
  25.         for(int i = 0; i < 7; i++)
  26.         {
  27.             inputFile.nextLine();
  28.         }
  29.  
  30.         //loop through input file
  31.         while (inputFile.hasNext())
  32.         {
  33.             String strRecord = inputFile.nextLine() + " ";
  34.             if(strRecord.length() > 65)
  35.             {
  36.                 //instantiate NWSFB
  37.                 NWSFB fb = new NWSFB(strRecord);
  38.                 //write to outputfile
  39.                 outFile.println(fb.fmtWeatherReport());
  40.  
  41.             }
  42.             //close loop
  43.  
  44.  
  45.         }
  46.         //close files
  47.         inputFile.close();
  48.         outFile.close();
  49.         fWriter.close();
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement