Guest User

Untitled

a guest
Jul 16th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. //
  2. // This program lists a text file with
  3. // selected lines displayed in the listing.
  4. //
  5. // Course: CIS 1068
  6. // Student: Lastname, Firstname
  7. // Date: March 19, 2012
  8. //
  9.  
  10. import java.io.BufferedReader;
  11. import java.io.FileReader;
  12.  
  13. public class FileLister {
  14.  
  15. //
  16. // Function main
  17. //
  18.  
  19. public static void main(String[] args) throws Exception {
  20.  
  21. int count;
  22. String fileName;
  23. int hiBound = 0;
  24. String[] lines = new String[100];
  25. int loBound = 0;
  26. BufferedReader textFile;
  27.  
  28.  
  29. fileName = args[0];
  30.  
  31. textFile = new BufferedReader(new FileReader("latin.txt"));
  32.  
  33. fileName = textFile.readLine();
  34. System.out.println(fileName);
  35.  
  36.  
  37. if(args.length >= 2) {
  38. loBound = Integer.parseInt(args[1]);
  39. }
  40.  
  41. if(args.length == 3) {
  42. hiBound = Integer.parseInt(args[2]);
  43. }
  44.  
  45. if(args.length > 3) {
  46. System.out.println("Too many arguments provided, command ignored.");
  47. }
  48.  
  49. for(count = 0; (textFile.ready());) {
  50. lines[count++] = textFile.readLine();
  51.  
  52. } //end for
  53.  
  54. textFile.close();
  55. return;
  56.  
  57. } // end main
  58.  
  59. //
  60. // Method displayLines
  61. //
  62.  
  63. private static void displayLines(String[] lines, int loBound, int hiBound) {
  64.  
  65. String line;
  66.  
  67. //
  68. // Your code goes here...displayLines
  69. //
  70.  
  71. return;
  72.  
  73. } // end displayLines
  74.  
  75. } // end FileLister
Add Comment
Please, Sign In to add comment