Advertisement
Guest User

Untitled

a guest
May 26th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.Scanner;
  3. import java.util.Vector;
  4.  
  5. public class MedicalOrganizer {
  6.    
  7.    
  8.     public static void main(String[] args) {
  9.        
  10.         Scanner get = new Scanner (System.in);
  11.         Vector strUser, strPassword;
  12.         String strLoginU, strLoginP;
  13.        
  14.         strUser     = new Vector();
  15.         strPassword = new Vector();
  16.        
  17.         System.out.println ("Login:\n\n\n");
  18.         System.out.print ("Username: ");
  19.         strLoginU = get.next();
  20.         System.out.print ("Password: ");
  21.         strLoginP = get.next();
  22.        
  23.         int i = 0;
  24.        
  25.         try {
  26.             DataInputStream uin = new DataInputStream(new FileInputStream("Usernames.ini"));
  27.             DataInputStream pin = new DataInputStream(new FileInputStream("Passwords.ini"));
  28.             while ((uin.available() != 0) && (pin.available() != 0)) {
  29.            
  30.                 strUser.addElement(uin.readLine());
  31.                 strPassword.addElement(pin.readLine());
  32.                
  33.                 if ((strLoginU == strUser.elementAt(i)) && (strLoginP == strPassword.elementAt(i))) {
  34.                     System.out.println("Access granted.");
  35.                 }
  36.                
  37.                 i++;
  38.             }
  39.         } catch (Exception e) {
  40.             System.err.println ("error");
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement