1. There are many ways to design a solution to this problem but you are evaluated on meeting the specific specifications as given.

2. Use proper statement indentation and meaningful variable names in the code.

3. Place a multi-line Javadoc comment giving a description of the purpose of this application. Include your name and the date with the description. Also include descriptive Javadoc comments for each class and method in the project.

4. Output spacing, formatting, and spelling are to match the example console display illustrated above, but of course the user input can be different.

5. Create a class to create objects to be used in this application. Name the class MyEmployee with only these instance variables:

  • NameClass name
  • DepartmentEnum dept
  • String id
  • LocalDate hiredDate
  • String username
  • StringBuilder password

6. Create getter and setter methods for all the instance variables. Include a toString(). According to specification 9 below the setters for the username and password are private methods.

7. The private method to set the username will generate the username according to these specifications.

  • It will start with the first letter of the first name.
  • followed by the first letter of the middle name.
  • followed by the entire last name.
  • ending with the employee's name suffix

8. The private method to set the employee's password will generate the password according to these specifications:

  • It starts with the last character of the user's last name
  • followed by the day number of their hired date
  • followed by an asterisk ( * )
  • followed by third and fourth characters of their id
  • followed by the sum of the first digit and last digit in their id

9. Create a MyEmployee constructor that has the first four instance variables listed above as the only parameters. The remaining instance variable values are derived by private methods declared in the MyEmployee class. The username and password are not to be set by any user.

10. Use a modified version of the Console class given in chapter 7 in this application to validate user input. Validate the data so only acceptable values will be processed. If the user enters invalid data, the application should display the appropriate error message and prompt the user again until the user enters valid data. The user must enter data. See example output above to determine error messages and what data is valid.

11. Use a LinkedList in the application to store MyEmployee objects.

12. Create and use an Enumeration to store these constants: S, HW, P, W, Pay. Include and use a toString() method to display readable strings that describe the constants as illustrated in the example output. Readable strings are Sales, House Wares, Personnel, Warehouse, Payroll.

13. Create and use a class called NameClass. You need to determine the instance variables and methods necessary for this class in this application. Include a private method to display a readable string for the suffix. Readable strings are Senior, Junior, the Second, the Third, the Fourth, Esquire.

14. Place the Console class and the class with the main method in a package named edu.alamo.ui. Place the Enumeration, the NameClass, and the MyEmployee classes in a package named edu.alamo.business.

15. Display a menu so a user can (1) add employees to the LinkedList, (2) display list of employees' names and hired dates, (3) display a list of employees names, ids, and departments, and (4) display employees usernames and passwords. The menu will also provide a menu command that lists all the menu options and an exit command to exit from the application.

16. The application will create and access the LinkedList of employees' data. Implement each option that is on the menu.

17. The application must contain and implement at least these seven methods in the class with the main method to fully meet specifications 15 and 16. Use the names specified. The functionality each method will perform in the application is summarized below.

  • main method- This method will declare and initialize necessary entities and control execution of the code. Anything not handled is the other classes or the methods listed will be accomplished by the main method.
    • parameter: whatever is necessary
    • return data type: whatever is necessary
  • displayMenu method- This method will only display a menu for the user.
    • parameter: whatever is necessary
    • return data type: whatever is necessary
  • listHiredDate method - This method will display the employees' names and hired dates.
    • parameter: whatever is necessary
    • return data type: whatever is necessary
  • listPassword method - This method will display the employees' usernames and passwords
    • parameter: whatever is necessary
    • return data type: whatever is necessary
  • listIds method- This method will display the employees' names, IDs, and departments
    • parameter: whatever is necessary
    • return data type: whatever is necessary
  • addNameObject method - This method will create a NameClass object from prompted user input.
    • parameter: whatever is necessary
    • return data type: whatever is necessary
  • addEmployee method - This method will create a MyEmployee object from prompted user input.
    • parameter: whatever is necessary
    • return data type: whatever is necessary

Console.java

import java.util.Scanner;

public class Console {
public static double getDouble(Scanner sc, String prompt) {
double d = 0.0;
boolean isValid = false;
while (!isValid) {
System.out.print(prompt);
if (sc.hasNextDouble()) {
d = sc.nextDouble();
isValid = true;
} else {
System.out.println("Error! Invalid decimal value. Try again.");
}
sc.nextLine(); // discard any other data entered on the line
}
return d;
}

public static double getDouble(Scanner sc, String prompt,
double min, double max) {
double d = 0.0;
boolean isValid = false;
while (!isValid) {
d = getDouble(sc, prompt);
if (d <= min) {
System.out.println(
"Error! Number must be greater than " + min + ".");
} else if (d >= max) {
System.out.println(
"Error! Number must be less than " + max + ".");
} else {
isValid = true;
}
}
return d;
}

public static int getInt(Scanner sc, String prompt) {
int i = 0;
boolean isValid = false;
while (!isValid) {
System.out.print(prompt);
if (sc.hasNextInt()) {
i = sc.nextInt();
isValid = true;
} else {
System.out.println("Error! Invalid integer value. Try again.");
}
sc.nextLine(); // discard any other data entered on the line
}
return i;
}

public static int getInt(Scanner sc, String prompt,
int min, int max) {
int i = 0;
boolean isValid = false;
while (!isValid) {
i = getInt(sc, prompt);
if (i <= min) {
System.out.println(
"Error! Number must be greater than " + min + ".");
} else if (i >= max) {
System.out.println(
"Error! Number must be less than " + max + ".");
} else {
isValid = true;
}
}
return i;
}
}
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.