import java.util.Scanner;
public class MyClass() {
public static void main(String[] args) throws FileNotFoundException {
int[] firstyr = new int[15];
int[] lastyr = new int[15];
String[] title = new String[15];
String[] network = new String[15];
Scanner input = new Scanner(new File("tvshows.txt"));
int totalShows = 0;
int i = 0;
while(input.hasNextLine()) {
String line = input.nextLine(); // 1989 1997 Coach ABC
String[] fields = line.split(); // [ "1989", "1997", "Coach", "ABC" ]
firstyr[i] = fields[0]; //1989
lastyr[i] = fields[1]; //1997
title[i] = fields[2]; //Coach
network[i] = fields[3]; //ABC
i++;
}
input.close(); // Should always close your Scanner
printSentences(firstyr, lastyr, title, network);
}// end main
public static void printSentences(int[] firstyr, int[] lastyr, String[] title, String[] network) {
for(int i = 0; i < firstyr.length - 1; i++) { //assuming they'll always be the same length
System.out.printf("%s aired from %d to %d on %s.\n", title[i] , firstyr[i] , lastyr[i] ,network[i]);
}
}
}