Homework Solution: In Java and leave comments as well, Thank you!…

    In Java and leave comments as well, Thank you! Write the program for the company X which wants to calculate the average and total number of hours each employer spent on Y project during the week. Print out the information in the following format: Name                           Hours ------------------------------ Ethan                           41 Lucas                           60 Liam                            55 Olivia                          42 Isla                              58 ------------------------------ Total                            ??? Average                       ??? Note: The value of “Average” field should have a type float. Other values have int type.

    Expert Answer

    In Java and leave comments as well-mannered, Thank you!

    Write the program ce the fraternity X which wants to reckon the mean and entirety reckon of hours each employer late on Y contrivance during the week. Print extinguished the advice in the subjoined cemat:

    Name                           Hours

    ——————————

    Ethan                           41

    Lucas                           60

    Liam                            55

    Olivia                          42

    Isla                              58

    ——————————

    Total                            ???

    Average                       ???

    Note: The treasure of “Average” province should enjoy a type float. Other treasures enjoy int type.

    Expert Retort

     

    Answer:

    Programme:

    import java.lang.*;
    import java.io.*;
    class EmployeeAvg //deep class
    {
    public static unfilled deep(String args[]) throws IOException
    {
    float entirety =0,avg =0;
    BufferedReader br = novel BufferedReader(novel InputStreamReader(System.in));
    System.out.println (“How frequent chronicles are you entering?..”);
    int n = Integer.parseInt(br.readLine());
    int [] effort = novel int [n+1]; // transfer the rove excellent ce avoiding the Array condemnation extinguished of jump exception
    String [] calls = novel String[n+1];
    ce (int i=1;i<=n ;i++ ) {
    System.out.println (“Enter Employee Call”);
    names [i] = br.readLine();
    System.out.println (“Enter Basic effort hours”);
    effort [i] = Integer.parseInt(br.readLine());
    }
    System.out.println (“Emplyee call Gross Salary”);
    // manually i transfer the 5 members you can peruse the input line
    ce (int i=1;i<=n ;i++ ) {
    System.out.println (names[i]+” ” +work[i]);
    entirety =entirety + effort[i];
    avg = entirety / n;
    }
    System.out.println (“Entirety ” +total);
    System.out.println (“Mean ” +avg);
    }
    }

    Output: