Guest User

Untitled

a guest
Apr 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.util.HashMap;
  3. import java.util.Scanner;
  4. import java.io.*;
  5.  
  6. public class Assignment5
  7. {
  8. public static void main(String[] args) throws IOException
  9. {
  10. HashMap<Integer,String> users = new HashMap<Integer,String>();
  11. String username;
  12. String password;
  13. Scanner keyboard = new Scanner(System.in);
  14. System.out.print("Enter filename: ");
  15. String filename = keyboard.nextLine();
  16.  
  17. File file = new File(filename);
  18. Scanner inputFile = new Scanner(file);
  19.  
  20. while(inputFile.hasNext())
  21. {
  22. id = Integer.parseInt(inputFile.Next());
  23. name = inputFile.nextLine();
  24. users.put(username, password);
  25. }
  26.  
  27. inputFile.close();
  28. System.out.println("Login: ");
  29. username = keyboard.next();
  30. System.out.println("Password: ");
  31. password = keyboard.next();
  32.  
  33. }
  34. }
Add Comment
Please, Sign In to add comment