Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.Scanner;
- import java.util.Vector;
- public class MedicalOrganizer {
- public static void main(String[] args) {
- Scanner get = new Scanner (System.in);
- Vector strUser, strPassword;
- String strLoginU, strLoginP;
- boolean blnLogged = false;
- strUser = new Vector();
- strPassword = new Vector();
- System.out.println ("Login...");
- while (blnLogged == false) {
- System.out.print ("\nUsername: ");
- strLoginU = get.next();
- System.out.print ("Password: ");
- strLoginP = get.next();
- int i = 0;
- try {
- DataInputStream uin = new DataInputStream(new FileInputStream("Usernames.ini"));
- DataInputStream pin = new DataInputStream(new FileInputStream("Passwords.ini"));
- while ((uin.available() != 0) && (pin.available() != 0)) {
- strUser.addElement(uin.readLine());
- strPassword.addElement(pin.readLine());
- if ((strLoginU.compareTo(String.valueOf(strUser.elementAt(i))) == 0) && (strLoginP.compareTo(String.valueOf(strPassword.elementAt(i))) == 0)) {
- blnLogged = true;
- }
- i++;
- }
- } catch (Exception e) {
- System.err.println (e);
- }
- if (blnLogged == false) {
- System.out.println ("\nIvalid username/password, please try again.");
- }
- }
- System.out.println ("\nAccess granted.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement