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:
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.
8. The private method to set the employee's password will generate the password according to these specifications:
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.
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;
}
}