Guest User

Untitled

a guest
Jul 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. public void loadBookFromFile(String filename) throws FileNotFoundException {
  2.  
  3. Scanner inFile = new Scanner(new FileReader(filename));
  4.  
  5. String firstName, lastName, fullName;
  6. int month, day, year;
  7. String street, city, state;
  8. String zip;
  9. String phone, status;
  10.  
  11. while (inFile.hasNext() == true)// *1
  12. {
  13. firstName = inFile.next();
  14. lastName = inFile.next();
  15. month = inFile.nextInt(); // System.out.println("Month: " + month);
  16. day = inFile.nextInt(); // //System.out.println("Day: " + day);
  17. year = inFile.nextInt();
  18.  
  19. inFile.nextLine();
  20.  
  21. street = inFile.nextLine(); // System.out.println("street: " +
  22. // street);
  23. city = inFile.nextLine(); // System.out.println("city: " + city);
  24. state = inFile.nextLine(); // System.out.println("state: " + state);
  25. zip = inFile.nextLine(); // System.out.println("zip: " + zip);
  26.  
  27. phone = inFile.nextLine(); // System.out.println("Phone: " + phone);
  28. status = inFile.nextLine(); // System.out.println("Status: " +
  29. // status);
  30.  
  31. ExtPerson newPerson = new ExtPerson(firstName, lastName, month,
  32. day, year, street, city, state, zip, phone, status);
  33. addressList.insertLast(newPerson);
  34.  
  35. }
  36.  
  37. inFile.close();
  38. }
Add Comment
Please, Sign In to add comment