Question: JAVA PLEASE This program practices maps and sets. Data file users.txt contains a user identification followed by passwords in blank separated format with one data
JAVA PLEASE This program practices maps and sets.
Data file users.txt contains a user identification followed by passwords in blank separated format with
one data set per line. The current password listed first, the second most recent is listed second, etc.
Tasks:
Read the data into a map where the user identification is the key and a list of passwords is the value.
Display the map.
In the interactive portion, a person will enter their user identification. If the user id is not found in
the map, this is a new user. Ask for a new password, looping until valid, and add to the map.
For an existing user, ask the user for the current password using a data validation loop. There are a
maximum of tries and then the program ends.
For an existing user who has logged in correctly, ask the user for a new password, subject to the rules
below, using a data validation loop until a valid password is entered.
Create sets to assist in the task of verifying the new password. This code should use set operations such
as union and intersection. There are many other solutions but this week the code should use sets. Once
a valid password is entered, it becomes the current password, stored first in the password list. Update
the map.
a Create a set of upper case letters
b Create a set of lower case letters
c Create a set of digits
d Create a set of valid characters using the union method
d Create a set of characters in the password.
Password Rules:
length at least
contains at least one upper case letter is intersection of upper case set and password set empty?
contains at least one lower case letter is intersection of lower case set and password set empty?
contains at least one digit is intersection of digit set and password set empty?
cannot contain the user identification
cannot contain any other characters than upper case, lower case and digits is intersection of
valid characters set and password set the same length as the password set?
Display the final map.Existing user with valid login valid new password note that the current password is first in the list
Existing user but cannot login due to friled tries.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
