|
can someone answer this ? its so hard for me public class ArrayOfEmployees { static Scanner kb = new Scanner (System.in);
public static void main ( ) {
final int SIZE = 100;
String [ ] empID = new String [SIZE]; //array of employee's id
String [ ] empName = new String [SIZE]; //array of employee's name
double [ ] empSal = new double [SIZE]; //array of employee's salary
int response;
System.out.println ("\fInput " + SIZE + " of Empolyees' Records");
accept (empID, empName, empSal);
System.out.println (“\nUnsorted lists output:”);
displayAllEmp (empID, empName, empSal);
do {
System.out.println (“\nEmployee ID is found in location “ + searchByID (empID, empName, empSal));
System.out.println (“\nThere are “ + countEmpSalary (empSal, sal) + “ whose salary is above “ + sal);
System.out.println ("\nReapeat? Press [0] to stop. >>> ");
response = kb.nextInt();
}while (response != 0);
sortBySalaryInDescending (empID, empName, empSal);
System.out.println (“\nSorted lists output by Employee's Salary in Descending Order”);
displayAllEmp (empID, empName, empSal);
sortByEmpNameInAscending (empID, empName, empSal);
System.out.println (“\nSorted lists output by Employee's Name in Ascending Order”);
displayAllEmp (empID, empName, empSal);
do {
System.out.println (“\nEmployee's name is found in location “ + searchByName (empID, empName, empSal));
System.out.println (“\nThere are “ + countEmpSalary (empSal, sal) + “ whose salary is above “ + sal);
deleteSpecificEmpByID (empID, empName, empSal);
System.out.println ("\nReapeat? Press [0] to stop. >>> ");
response = kb.nextInt();
}while (response != 0);
}//End of method main
//Method Descriptions.
//You may also add a code in the main method if you think it is necessary but never delete from the existing code.
1. accept (empID, empName, empSal) – 10 points
- input N number of employees’ records. ID number must be unique. If ID number is not unique, discard the input.2. displayAllEmp (empID, empName, empSal) – 5 points
- display all employees’ records in table form 3. searchByID (empID, empName, empSal)) – 5 points
- Input employee’s ID to be searched. Display employee’s information if found, otherwise, display an appropriate message. Use linear search in searching. 4. searchByName (empID, empName, empSal)) – 5 points
- Input employee’s name to be searched. Display employee’s information if found, otherwise, display an appropriate message. Use binary search in searching. 5. countEmpSalary (empSal, sal) – 5 points
- count and returns the number of employee whose salary is greater than sal 6. sortBySalaryInDescending (empID, empName, empSal) – 5 points
- arrange the records in descending order using salary as the key 7. sortByEmpNameInAscending (empID, empName, empSal) - 5 points
- arrange the records in ascending order using name as the key 8. deleteSpecificEmpByID (empID, empName, empSal) – 5 points
- Inputs ID to be deleted. If found, remove the record, otherwise, display appropriate message. } |