This assignment requires you to develop a java program for such a scenario that the manager of a fast food store wants to use it for calculating weekly wage for N employees. N should be declared as a constant and set N=5 or N=7 for the purpose of test. The program requires displaying, sorting and searching the stored data such as employee name, and the worked hours with corresponding wages as shown in figures on the next few pages.

Like assignment 1, the hourly pay rate depends on the skill level of an employee as below:

Skill level Hourly rate
1 $15
2 $17
3 $21

The calculation scheme of wage for each employee is the same as in assignment 1. But the program requires validation for the input data employee name and worked hours. A valid name is assumed only to contain English letters, a space between first name and surname, and the length is not exceeding 25 letters. An example of an invalid input of employee name can be found in the Figure 8 on page 6. The valid value of weekly worked hours must be at the range between 0 and 60. An error message should be displayed and re-entering data is required, if the user enters the worked hours outside this range.

The data of employee names, worked hours and the calculated wages (unsorted) are required to store in three arrays (The sample data in Figure 2 on next page contain 5 records. You can enter these sample data to test your program functionality). You must use parallel arrays or ArrayLists in this assignment to store these data. Your application should display and execute a menu with the following options. A switch statement must be used to execute the following menu options.

Note: if the user has not entered the employee data and one of options between 2 and 7 is selected, an error message should be displayed and the program returns to the main menu.

1. Input & validate data

2. Display

3. Sort by name

4. Sort by hours

5. Search by name

6. Search by hours

7. Statistics

8. Exit

The details for each option are described as below.

1. Input & validate data

This option reads each employees name, skill level, and worked hours for N people from the keyboard. The name and worked hours must be stored in two separate one-dimension arrays/arraylists. Figure 1 shows a sample input for a personal data. If the input of worked hours exceeds the ranges defined on the last page, then an appropriate message should be displayed and the user should be asked to re-enter a new value. In addition, the input of employees name must be validated as required on page 1.

2. Display

This option displays the employee names, worked hours and calculated wages that are stored in Arrays/ArrayLists for all employees entered, as shown in Figure 2.

3. Sort by name

When this option is selected, the names of employee are sorted in ascending order and this option also displays sorted names with their worked hours and wage data, as shown in Figure 3.You can use any sorting algorithm which uses at least two while loops and one if statement. A built-in sort should not be used.

4. Sort by hours

This option sorts the worked hours in ascending order and displays the corresponding changes of employee names and wages, as shown in Figure 4.

5. Search by name

When the Search by name option is executed and the user enters a employees name regardless of the lower case or upper case in the name spelling, the worked hours, and wage for that employee will be displayed as shown in Figure 5 (In this example, the employees name james baker is entered). If the entered name doesnt match any existing name, it should display a warning message.

6. Search by hours

If the user selects this option and enters a particular number of worked hour, the running program will display the employee names and worked hours that are less than the particular number. Figure 6 shows an example where the specific number of hours is 15.

7. Statistics

If the user selects this option, the program will calculate and display the lowest and highest value of worked hours and corresponding employee names, and the median worked hours, as shown in Figure 7.

8. Exit

Selecting Exit option will exit the execution of the program.

Figure 1 and 2. see image.

Figure 3 and 4. see image.

Figure 5 and 6. see image.

Figure 7 and 8. see image.

Program design

You may use any design that meets the specification. However, a good design will adhere to the following guidelines:

  • be logically correct
  • be easy to read and maintain
  • be well-designed
  • use UML class diagram
  • use following class and methods
public class EmployeeDataManager
{
public EmployeeDataManager( ) //constructor
public void displayMenu()
public void inputData()
public void sortByName( )
public void sortByHours( )
public void searchByName( )
public void searchByHours( )
public void statistics( )
public boolean isValidName(String name)
helper methods here if any
public static void main(String [ ] args)
{
.........
}
}

Testing

Testing is important. You should:

  • list the different types of test cases.
  • display the results of each test case.
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.