Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3.1 User Requirements User requirements for this system include the customer’s a

ID: 3813986 • Letter: 3

Question

3.1 User Requirements User requirements for this system include the customer’s ability to: Create a username and password for the system; Login to the system; Reset passwords; Reset usernames; Connect with IT support for the system; Create a new alumnus record; Edit an existing alumnus record; Remove existing alumnus record; Code individual alumnus records to be added and removed from mailing lists; Create and maintain multiple mailing lists of alumni; Search for individual alumnus records by one or more of the following variables: first name, last name, Social Security Number, date of birth, graduation year, KSU ID number, degree earned, graduation status, donation history, street address, country/state of residence, phone number, e-mail address. Filter alumnus records one or more of the following variables: first name, last name, Social Security Number, date of birth, graduation year, KSU ID number, degree earned, graduation status, donation history, street address, country/state of residence, phone number, e-mail address.

3.2 Question System Requirements List detailed system requirements here. If your system is large, you may wish to break this into several subsections. 3.3 Interface Requirements List interface requirements here; or include screen mockups. If you use mockups, be sure to explain major features or function with narrative to avoid confusion or omission of desired features.

Explanation / Answer

import java.util.Scanner; // I use scanner because it's command line. public class Login { public void run() { Scanner scan = new Scanner (new File("the\dir\myFile.extension")); Scanner keyboard = new Scanner (System.in); String user = scan.nextLine(); String pass = scan.nextLine(); // looks at selected file in scan String inpUser = keyboard.nextLine(); String inpPass = keyboard.nextLine(); // gets input from user if (inpUser.equals(user) && inpPass.equals(pass)) { System.out.print("your login message"); } else { System.out.print("your error message"); } } }

package jdialogdemo;

public class Login {

    public static boolean authenticate(String username, String password) {

        // hardcoded username and password

        if (username.equals("bob") && password.equals("secret")) {

            return true;

        }

        return false;

    }

}

package jdialogdemo;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.border.*;

public class LoginDialog extends JDialog {

    private JTextField tfUsername;

    private JPasswordField pfPassword;

    private JLabel lbUsername;

    private JLabel lbPassword;

    private JButton btnLogin;

    private JButton btnCancel;

    private boolean succeeded;

    public LoginDialog(Frame parent) {

        super(parent, "Login", true);

        //

        JPanel panel = new JPanel(new GridBagLayout());

        GridBagConstraints cs = new GridBagConstraints();

        cs.fill = GridBagConstraints.HORIZONTAL;

        lbUsername = new JLabel("Username: ");

        cs.gridx = 0;

        cs.gridy = 0;

        cs.gridwidth = 1;

        panel.add(lbUsername, cs);

        tfUsername = new JTextField(20);

        cs.gridx = 1;

        cs.gridy = 0;

        cs.gridwidth = 2;

        panel.add(tfUsername, cs);

        lbPassword = new JLabel("Password: ");

        cs.gridx = 0;

        cs.gridy = 1;

        cs.gridwidth = 1;

        panel.add(lbPassword, cs);

        pfPassword = new JPasswordField(20);

        cs.gridx = 1;

        cs.gridy = 1;

        cs.gridwidth = 2;

        panel.add(pfPassword, cs);

        panel.setBorder(new LineBorder(Color.GRAY));

        btnLogin = new JButton("Login");

        btnLogin.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                if (Login.authenticate(getUsername(), getPassword())) {

                    JOptionPane.showMessageDialog(LoginDialog.this,

                            "Hi " + getUsername() + "! You have successfully logged in.",

                            "Login",

                            JOptionPane.INFORMATION_MESSAGE);

                    succeeded = true;

                    dispose();

                } else {

                    JOptionPane.showMessageDialog(LoginDialog.this,

                            "Invalid username or password",

                            "Login",

                            JOptionPane.ERROR_MESSAGE);

                    // reset username and password

                    tfUsername.setText("");

                    pfPassword.setText("");

                    succeeded = false;

                }

            }

        });

        btnCancel = new JButton("Cancel");

        btnCancel.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {

                dispose();

            }

        });

        JPanel bp = new JPanel();

        bp.add(btnLogin);

        bp.add(btnCancel);

        getContentPane().add(panel, BorderLayout.CENTER);

        getContentPane().add(bp, BorderLayout.PAGE_END);

        pack();

        setResizable(false);

        setLocationRelativeTo(parent);

    }

    public String getUsername() {

        return tfUsername.getText().trim();

    }

    public String getPassword() {

        return new String(pfPassword.getPassword());

    }

    public boolean isSucceeded() {

        return succeeded;

    }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote