Question: Please develop a Java program to: 1. Read all records from password.csv file into a Password array 2. Prompt the user to enter a user
Please develop a Java program to:
1. Read all records from password.csv file into a Password array
2. Prompt the user to enter a user name
3. Prompt the user to enter the corresponding password
4. Validate the entered username and password
By checking the entered user name and password against Password array (created in Step 1)
Your comments must contain:
The purpose of the program
Your program logic
Input data file name: password.csv
The password.csv file is a csv (comma separated value) file and contains less than 5,000 records/lines. Each line/record consists of 2 fields: username/emailAddress, password.
Listed below are 2 sample records/lines:
steven@adamaitis.com, Adamaitis
janine@addington.com, Addington
import java.util.*; // Data class to represent a password record class Password { String userName, password; public Password(String u, String p) { userName = u; password = p; } public Password(String r) { StringTokenizer st = new StringTokenizer(r.trim(), ","); userName = st.nextToken(",").trim(); password = st.nextToken(",").trim(); } public String getUserName() { return userName; } public String getPassword() { return password; } public String toString() { return userName + " " + password; } } // Password Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
