+1 123 456 7890 instantessays65@gmail.com

(answered) – 1) Create data storage for each “user” with the attached

$11.00

(answered) – 1) Create data storage for each “user” with the attachedDescriptionSolution downloadThe Question1) Create data storage for each “user” with the attached “Person.java” file.2) Implement the CompareTo() method from the “Comparable” interface inside the Person class.3) Store all the users in an arrayList of “Person” objects.4) Use an enhanced for loop to iterate through the arrayList of person objects and then compare the “temp” Person from the user input.5) In this version, only return zero if the objects match (meaning password=password, username=username, and studentID=studentID)In the following programimport java.awt.*;import java.awt.event.*;import java.io.*;import javax.swing.*;public class Login {//path to the USERDATA.txt file that contains username & passwordpublic static final String fileName = “USERDATA.txt”;public static void main(String[] args) {JFrame frame = new JFrame(“Student Login”);frame.setSize(400, 400);frame.setLocation(450,400);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);JPanel panel = new JPanel();frame.add(panel);placeComponents(frame, panel);frame.setVisible(true);}private static void placeComponents(final JFrame frame, JPanel panel) {panel.setLayout(null);JLabel studentIDlabel = new JLabel(“Student ID”);studentIDlabel.setBounds(10, 100, 80, 25);studentIDlabel.setFont(new Font(“NEW TIMES ROMAN”,Font.ITALIC,15));studentIDlabel.setForeground(Color.BLUE);panel.add(studentIDlabel);final JTextField studentIDText = new JTextField(20);studentIDText.setBounds(100, 100, 160, 25);panel.add(studentIDText);JLabel lblUserName = new JLabel(“Username”);lblUserName.setBounds(10, 140, 80, 25);lblUserName.setFont(new Font(“NEW TIMES ROMAN”,Font.ITALIC,15));lblUserName.setForeground(Color.BLUE);panel.add(lblUserName);final JTextField userText = new JTextField(20);userText.setBounds(100, 140, 160, 25);panel.add(userText);JLabel lblPassword = new JLabel(“Password”);lblPassword.setBounds(10, 180, 80, 25);lblPassword.setFont(new Font(“NEW TIMES ROMAN”,Font.ITALIC,15));lblPassword.setForeground(Color.BLUE);panel.add(lblPassword);final JPasswordField passwordText = new JPasswordField(20);passwordText.setEchoChar(‘*’);passwordText.setBounds(100, 180, 160, 25);panel.add(passwordText);JButton btnLogin = new JButton(“Login”);btnLogin.setBounds(10, 300, 80, 25);panel.add(btnLogin);JButton exitButton = new JButton(“Exit”);exitButton.setBounds(180, 300, 80, 25);exitButton.setFont(new Font(“NEW TIMES ROMAN”,Font.ITALIC,15));exitButton.setForeground(Color.RED);panel.add(exitButton);btnLogin.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {int valid = validate(e, studentIDText, userText,passwordText);if(valid==0){showMessage(“USERDATA.txt”,e);}}});exitButton.addActionListener(new ActionListener() {@Overridepublic void actionPerformed(ActionEvent e) {frame.dispose();}});}private static int validate(ActionEvent e, JTextField studentIDText,JTextField userText, JTextField passwordText){int errors = 0;//validate studentIDString studentID =studentIDText.getText();if(errors==0){try{Long.parseLong(studentID);}catch(Exception ex){errors++;showMessage(“Invalid input. Please enter a “+ “valid student ID”,e);}}//validate usernameString username = userText.getText();if(errors==0){if(username.length()==0){errors++;showMessage(“Invalid input. Please enter a “+ “valid username”,e);}}//validate passwordString password = passwordText.getText().trim();if(errors==0){if(password.length()==0 || password.length() errors++;showMessage(“Invalid input. Please enter a “+ “valid password”,e);}if(password.contains(“,”) && errors==0){errors++;showMessage(“Invalid input. Password cannot “+ “contain a comma”,e);}if(checkForOneUppercase(password)==false &&