Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that computes weekly hours for each employee. Store the weekly hours for all employees in a two - dimensional array. Each row
Write a program that computes weekly hours for each employee. Store the weekly hours for all employees in a twodimensional array. Each row records an employee's sevenday work hours with seven columns. For example, the following array stores the work hours for eight employees. Display employees and the total hours of each employee in decreasing order of the total hours.
tableSuMTWRFSaEmployeeEmployeeEmployeeEmployeeEmployeeEmployeeEmployeeEmployee
Requirements:
Design a method that takes the D array of weekly hours of all employees as an input parameter, calculates the sum of the total hours of all employees and returns the total hour results in an array.
Design a method to sort the above returned array in Requirement in descending order by selection sort.
Important: when sorting the array, the program should keep track of which employee corresponds to how many work hours. Therefore, you should store the employee information in an array and return it as a result of your sort method.
Design a method to display the results of employees and their total hours in decreasing order. The sample output for the above example is as follows:
Design a main method that uses the short hand initializer to initialize the D array of weekly hours of all employees and invokes all the three methods in Requirements in a sequence. How to hand in the assignment
When you finish your assignment, you will upload submit it to Gradescope. I remind you that
submit the assignment before the due date, you will not be able to submit it
Complete the assignment and name it HW
Return to the Gradescope to submit the java file for this assignment.
Browse for the HWjava file that you have on your computer and select it so that it upl
assignment area.
Click "Upload".
For this assignment, please name your class file as HW
package homework;
public class HW
public static void mainString args
int workHours
;
int sumArray calculateSumworkHours;
int indexArray decreasingSortsumArray;
displayArrayindexArray sumArray;
public static int calculateSum int array
Please write your code here
Finally, your code's formatting should look exactly like the output mentioned below and should be able to
run compile.
Employee: hours
Employee: hours
Employee: hours
Employee: hours
Employee: hours
Employee: hours
Employee: hours
Employee: hours
JAVA AND EXACT OUTPUT PLEASE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started