Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. import java.io.FileInputStream;
  2. import java.io.FileNotFoundException;
  3. import java.util.Scanner;
  4. public class PetRecordDriver
  5. {
  6. private static final String FILE_NAME = "pets.txt" ;
  7.  
  8. public static void main(String[] args)
  9. {
  10.  
  11. String workingDirectory = System.getProperty("user.dir") ;
  12. String absolutePath = workingDirectory + "\\src\\" + FILE_NAME ;
  13. System.out.println("The absolute path is: " + absolutePath) ;
  14.  
  15. // Set up Scanner and attach to "pets.txt"
  16. FileInputStream fileInputStream = null ;
  17. try
  18. {
  19. fileInputStream = new FileInputStream(absolutePath);
  20. }
  21. catch (FileNotFoundException e)
  22. {
  23. System.out.println("Couldn't find file " + FILE_NAME + " - aborting!");
  24. System.exit(0) ;
  25. }
  26. Scanner petScanner = new Scanner(fileInputStream);
  27.  
  28. int pets = 9;
  29.  
  30. PetRecord[] PetRecordArray = new PetRecord[pets]; //The array of pet records
  31.  
  32. for (int x = 0; x > PetRecordArray.length; x++)
  33. {
  34. PetRecordArray[x] = new PetRecord();
  35.  
  36. }
  37.  
  38.  
  39.  
  40.  
  41. }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement