Question
Suppose the weekly worked hours for all employees are stored in a text file. Each line in the file consists of the employees name and
Suppose the weekly worked hours for all employees are stored in a text file. Each line in the file consists of the employees name and the employees seven-day work hours. Write a program that reads the data from the file and save the names in a single dimensional array. The worked hours should be saved in a two-dimensional array. Each row records an employees seven-day work hours with seven columns. For example, the following array stores the work hours for four employees. Write a program that Compute the total hours worked by each employee and save them in one dimensional array. Compute the wages of employees as follows: up to 40 hours per week the hour price is 20 otherwise, the overtime hour price is 1.2 regular hour price. Design a menu to the user so that he can choose from as follows where the menu is presented to user as long as he does not select 5: 1. Display employee User entered employee name, Search for employee by name and display his wage and total hours 2. Display employees Show employee names in decreasing order of the total hours and their wages 3. Display most active employee Employee with highest total hours 4. Display average wage and number of employees above average. 5. Display work statistics 3 categories of total hours{0-19, 20-39, 40-49, >=50} Count the number of employees in each category & Display total hours distribution as bar chart, total Hour distribution for the sample data given above is: 0-19 * 20-39 **** 40-49 ** >=50 * 6. Quit Notes: Use Stepwise refinement. ( break the problem into smaller manageable sub problems) Use methods in your code (modular code), some of them are listed here for your benefit: int[] calTotalHrs(int[][] hrs) double[] calWages(int[] tHrs) printStr(String[] str) double avgWage(double[] wages) int aboveAvg(double[] wages, double avg) boolean search(String name) int [] hoursDist(int[] tHrs) String[] barChart(int[] hDist ) int activeEmployee(int[] tHrs) End of question
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