QuestionQuestion

Create an hours reporting program that collects the hours of employees into a neat report. The program will complete the following tasks:
a) Ask the user for the number of employees
b) For each employee:
a. Collect each employee name (store in String[] empNames)
b. Collect the Pay Rate for Each employee
c. Collect the hours for each employee in a 2D array (use double[][] hours)
c) Calculate the total hours for each employee (use double[] empHours)
For this part, you must reference the dimensions of the ‘hours’ array in controlling the loops.
d) Calculate the total hours for each day (use double[] dayHours)
e) Calculate how much they should be paid for the hours they worked
f) Report the results in a formatted table using printf.
Recall that %s is used for Strings, %f for doubles.
%-10s will left align a String in a column of width 10
%10.4f will show double values with 4 digits to the right of the decimal point in a column of width 10

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.Scanner;

public class HoursReportingProgram {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
      
       int num;
       Scanner keyboard = new Scanner(System.in);
      
       //a) Ask the user for the number of employees
       System.out.print("How many employees: ");
       num = keyboard.nextInt();
      
       if (num > 0) {
            String[] empNames = new String[num];
            double [] payRate = new double[num];
            double[][] hours = new double[num][7];
            double[] empHours = new double[num];
            double[] dayHours = new double[7];
            double [] income = new double[num];...
$15.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats