Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

FileNotFoundException: Credentail.txt

/*

  • To change this license header, choose License Headers in Project Properties.
  • To change this template file, choose Tools | Templates
  • and open the template in the editor.
    */
    package authenticationsystem;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Scanner;

/**
*

Need assignment help for this question?

If you need assistance with writing your essay, we are ready to help you!

OUR PROCESS

Order

Payment

Writing

Delivery

Why Choose Us: Cost-efficiency, Plagiarism free, Money Back Guarantee, On-time Delivery, Total Сonfidentiality, 24/7 Support, 100% originality

  • @author jack
    */
    public class AuthenticationSystem { /**
    • @param args the command line arguments
    • @throws java.io.IOException
      */
      public static void main(String[] args) throws IOException {
      // TODO code application logic here
      loginScreenpro();
    } public static void loginScreenpro() { String gPassword = ""; int flag123 = 0, attempts123 = 3; BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Login"); try {do { attempts123--; System.out.println("Enter Username"); String userName = br1.readLine(); System.out.println("Enter Password"); String password = br1.readLine(); MessageDigest md123 = MessageDigest.getInstance("md5"); md123.update(password.getBytes()); byte[] bytes12 = md123.digest(); StringBuilder sb1 = new StringBuilder(); for (byte b : bytes12) { sb1.append(String.format("%02x", b & 0xff)); } gPassword = sb1.toString(); String currentLine; BufferedReader bin123 = new BufferedReader(new FileReader("Credentail.txt")); while ((currentLine = bin123.readLine()) != null) { String[] array123 = currentLine.split(" "); if (array123[0].equals(userName)) { if (array123[1].equals(gPassword)) { flag123 = 1; break; } } } if (attempts123 == 0) { System.out.println("login more times"); System.out.println("Exit..."); System.exit(0); } if (flag123 == 1) { adminScreenpro(); break; } else { System.out.println("Invalid Username or Password."); System.out.println(" try again."); System.out.println(attempts123 + " more attemptes left.n"); } } while (attempts123 > 0);} catch (NoSuchAlgorithmException e1) {e1.printStackTrace();} catch (IOException e1) {e1.printStackTrace();} } public static void adminScreenpro() { String logOut123; Scanner sc1 = new Scanner(System.in); System.out.println("Welcome Admin"); System.out.println("user Press 99 for log outn"); do {logOut123 = sc1.nextLine();} while (!logOut123.equals("99")); if (logOut123.equals("99")) {loginScreenpro();} }

}

 
"Looking for a Similar Assignment? Order now and Get 10% Discount! Use Code "Newclient"