Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // This program lists a text file with
- // selected lines displayed in the listing.
- //
- // Course: CIS 1068
- // Student: Lastname, Firstname
- // Date: March 19, 2012
- //
- import java.io.BufferedReader;
- import java.io.FileReader;
- public class FileLister {
- //
- // Function main
- //
- public static void main(String[] args) throws Exception {
- int count;
- String fileName;
- int hiBound = 0;
- String[] lines = new String[100];
- int loBound = 0;
- BufferedReader textFile;
- fileName = args[0];
- textFile = new BufferedReader(new FileReader("latin.txt"));
- fileName = textFile.readLine();
- System.out.println(fileName);
- if(args.length >= 2) {
- loBound = Integer.parseInt(args[1]);
- }
- if(args.length == 3) {
- hiBound = Integer.parseInt(args[2]);
- }
- if(args.length > 3) {
- System.out.println("Too many arguments provided, command ignored.");
- }
- for(count = 0; (textFile.ready());) {
- lines[count++] = textFile.readLine();
- } //end for
- textFile.close();
- return;
- } // end main
- //
- // Method displayLines
- //
- private static void displayLines(String[] lines, int loBound, int hiBound) {
- String line;
- //
- // Your code goes here...displayLines
- //
- return;
- } // end displayLines
- } // end FileLister
Add Comment
Please, Sign In to add comment