/*
 * File: ReverseFile.txt
 * ---------------------
 * This program reads in lines from a file and prints them
 * out in reverse order.
 */

import acm.program.*;
import java.util.*;
import java.io.*;

public class ReverseFile extends ConsoleProgram {
	
	private static final String FILENAME = "res/minipoem.txt";
	
	public void run() {
		
		try {
			Scanner scanner = new Scanner(new File(FILENAME));
			
			// read in all the lines from the file
			while (scanner.hasNextLine()) {
				String line = scanner.nextLine();
				println(line);
			}
			
			// TODO: update this program to print the file lines in reverse order
			
			
			scanner.close();
		} catch (IOException e) {
			println("Could not read file: " + e);
		}
	}
}
