Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Declare five ( 5 ) one-dimensional arrays t hat are named stuCode, stuHours, hou

ID: 3837450 • Letter: D

Question

Declare five (5) one-dimensional arrays that are named stuCode, stuHours, hourlyPay, grossPay, & netPay to store values for the student detail fields for each record.

stuCode should be an int array

stuHours should be an int array

hourlyPay should be a float or double array

grossPay should be a float or double array

netPay should be a float or double array

You may create additional arrays if you find it useful in solving the problem.

The values for any/all of the original Input fields, as defined by the test data, can either be initialized within the Java source code and/or be input from the keyboard to store the Test Data. Meaning if all the test data is initialized within the Java source code there is no input to enter.

DOE Monthly Sales Transactions

Date November 4, 2016

Pay Deductions (Rate) 13%

100

20

11.5

200

28

11.5

300

32

11.5

400

32

11.5

500

30

12.5

600

25

12.5

700

32

12.5

0

The values for the grossPay and netPay arrays must be calculated by the program during the execution of the program.

You must use at least one for loop to process the arrays.

If there is input from the keyboard then no report output should display until "after all input is complete".

The per item detail portion of the report should display the data stored in the:

stuCode

stuHours

hourlyPay

grossPay

netPay

arrays to the screen in a table format with neatly aligned columns and appropriate column headings as seen in the example below. Each array should represent a column in the output.
Note: Use of the space or tab character within the output string helps to make columns.

The summary portion of the report should display the data values along with appropriate titles/headings laid out neatly in a horizontal or vertical order.

All decimal output must have two decimal places with commas and trailing zeroes displayed when needed.

All monetary values must display with a leading dollar sign ($).

All monetary values must display with 2 decimal places with commas (when needed) and trailing zeroes.

This includes all floating point variables whether or not the variables are stored in an array.

Have a minimum of five methods in the second (non-driver) class. The appMain methods does count towards the minimum.

/*

Source Name:             Project3Driver.java

Data Written:              5/11/2017

Written By:

*/

import java. io*;

public class Projt3Driver

{

            public static void main(String args[] throws IOException

            {

                        Project3 app;

                        app = new Project3();

                        app.appMain ();

            }

}

class Project3

{

            // Data (Field) Declaration, so declare all your variables HERE

            BufferedReader stdin;

           

            int stuCode, hours;

            float hourlyPay, grossPay, netPay;

            int highHours, hiHoursStudent;

            String date;

            float deductionRate;

            int totstus, totOTHours;

            float totNetPay, overTimePay;

            float avgGrossPay, totGrossPay;

           

            void appMain() throws IOException

            {

                        outputHeader();

                        initReport();

                        getWeekInfo();

                        while (stuCode !=0)

                        {

                                    procStudent();

                        }

                        calculateAvg();

                        displaySummary();

            }

            void outputHeader()

            {

                        //Output report header.

                        System.out.println(“Solution for Proj #3”);

                        System.out.println(“GEST Weekly Payroll Report”)

                        System.out.println(“Name here”);

            }

            void initReport()

            {

                        // create input input object to connect to the keyboard

                        stdin = new BufferReader (new InputStreamReader(System.in));

           

                        totNetPay = 0;

                        highHours = 0;

                        totStus = 0;

                        stuCode = -1;               // initialize to any non-flag value

            }

            void getWeekInfo() throws IOExeption

            {

                        //output report header

                        System.out.print(“Please enter the date: “);

                        date = stdin. readLine();

                        System.out.Print(“Please enter the Pay Deductions Rate; “);

                        deductionRate = Float.parseFloat(stdin.redLine());

            }

            void procStudent() throws IOException

            }

                        getStuCode();

                        if (stuCode !=0)

                        {

                                    getStuDetails();

                                    if   (stuCode !=0)

                                    {

                                                getStuDetails();

                                                calcDetailsAndTotals();

                                                updateHighs();

                                                displayDetails();

                                    }

                        }

            void getStuCode() throws IOException

            {

                        System.out.println(“ =========== Student Input ===========”);

                        System.out.print(Please enter the Student ID Code; “);

                        stuCode = Integer.parseInt(stdin.redLine());

            }

            void getStuDetails() throws IOException

            {

                        System.out.print(“Please enter the number of hours worked; “);

                        Hours = Integer.parseInt(stdin.readLine());

                        System.out.print (“Please enter the hourly pay rate; “)

                        HourlyPay = Float.parseFloat(stdin.redLine();

            }

            void displayDetails()

            {

                        System.out.println(“ ”);

                        System.out.println(“Student Details: “)

                        System.out.println(“=======================================”);

                        System.out.println(“Student Code: Code: ” + stuCode);

                        System.out.println(“Hours Worked: ” + hours);

                        System.out.println(“Hourly Pay: ” + hourlyPay);

                        System.out.println(“Gross Pay: ” + grossPay):

                        System.out.println(“Net Pay: ” + netPay);

                        System.out.println(“=======================================”);

            }

            void calcDetailsAndTotals()

            {

                        //calculate for detail output

                        grossPay = hours * hourlyPay;

                       

                        if (hours > 25)

                        {

                                    grossPay = grossPay + ((hours - 25) * ((float)0.5 * hourlyPay));

                                    totOTHours = totOTHours + (hours – 25);

                        }

                        netPay = grossPay – (grossPay * deductionRate);

                        //calculate for report summary

                        totNetPay = totNetPay + netPay;

                        totGrossPay = totGrossPay + grossPay;

                       

                        totStus = totStus +1;

            )

            void updateHights()

            {

                        if (highHours < hours)

                        {

                                    highHours = hours:

                                    hiHoursStudent = stuCode;

                        }

            }

            void calculateAvg()

            {

                        avgGrossPay = totGrossPay / totStus;

            }

            void displaySummary()

            {

                        System.out.println(“ ”);

                        System.out.println(“*GEST WEEKLY PAYROLL REPORT SUMMARY*”)

                        System.out.println(“=======================================”);

                        System.out.println(“Date: ” + date);

                        System.out.println(“Deductions Rate: ” + deductionRate);

                        System.out.println(“=======================================”);

                        System.out.println(“Total Net Pay: ” + totNetPay);

                        System.out.println(“Total OT Hours: ” = totOTHours);

                        System.out.println(“Average Gross Pay: ” + avgGrossPay);

                        System.out.println(“High Hours Worked: ” + highHours);

                        System.out.println(“High Hours Student: ” + hiHoursStudent);

                        System.out.println(“=======================================”);

            }

}

Here is an example of what the program execution could resemble.


$ script proj5log
Script started, file is proj5log

$ javac Projk 5Driver.java

$ java Project5Driver


===========================================================================
Author: Name here
Project #5: A bigger and better GEST program.


===========================================================================
===========================================================================
GEST: Weekly Report
Date: November 4, 2016
Deductions Rate: 0.13
===========================================================================
STUDENT SUMMARY

Stu           Stu         Hourly        Gross          Net
Code        Hours   Pay             Pay               Pay
----          -----       ------           ---------      ---------
100           20          $11.50         $230.00         $200.10
200         28          $11.50         $339.25         $295.15
300         32          $11.50         $408.25         $355.18
400         32        $11.50         $408.25         $355.18
500         30        $12.50         $406.25         $353.44
600         25        $12.50         $312.50         $271.88
700           32        $12.50         $443.75         $386.06

-------------------------------------------
OVERALL SUMMARY
-------------------------------------------
Date:                              November 4, 2016
Deductions Rate:          0.13
Total Net Pay:              $2,216.98
Total OT Hours:            29
Average Gross Pay:     $364.04
High Hours Worked:       32

High Hour Stus:
---------------
300
400
700
===========================================================================
===========================================================================
$



$ cat Proj5Driver.java
/*

     Java implementation of Project #3 using simple Java Arrays
:
:


$ exit
Script done, file is proj5log

DOE Monthly Sales Transactions

Date November 4, 2016

Pay Deductions (Rate) 13%

Student Code Hours Worked Hourly Pay

100

20

11.5

200

28

11.5

300

32

11.5

400

32

11.5

500

30

12.5

600

25

12.5

700

32

12.5

0

Explanation / Answer

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package chegg.may;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
*
* @author Sam
*/
public class Projt3Driver

{

            public static void main(String args[]) throws IOException

            {

                        Project3 app;

                        app = new Project3();

                        app.appMain ();

            }

}

class Project3

{

            // Data (Field) Declaration, so declare all your variables HERE

            BufferedReader stdin;

         

            int stuCode, hours;

            float hourlyPay, grossPay, netPay;

            int highHours, hiHoursStudent;

            String date;

            float deductionRate;

            int totstus, totOTHours;

            float totNetPay, overTimePay;

            float avgGrossPay, totGrossPay;

         

            void appMain() throws IOException

            {

                        outputHeader();

                        initReport();

                        getWeekInfo();

                        while (stuCode !=0)

                        {

                                    procStudent();

                        }

                        calculateAvg();

                        displaySummary();

            }

            void outputHeader()

            {

                        //Output report header.

                        System.out.println("Solution for Proj #3");

                        System.out.println("GEST Weekly Payroll Report");

                        System.out.println("Name here");

            }

            void initReport()

            {

                        // create input input object to connect to the keyboard

                        stdin = new BufferedReader (new InputStreamReader(System.in));

         

                        totNetPay = 0;

                        highHours = 0;

                        totstus = 0;

                        stuCode = -1;               // initialize to any non-flag value

            }

            void getWeekInfo() throws IOException

            {

                        //output report header

                        System.out.print("Please enter the date: ");

                        date = stdin. readLine();

                        System.out.print("Please enter the Pay Deductions Rate; ");

                        deductionRate = Float.parseFloat(stdin.readLine());

            }

            void procStudent() throws IOException

            {

                        getStuCode();

                        if (stuCode !=0)

                        {

                                    getStuDetails();

                                    if   (stuCode !=0)

                                    {

                                                getStuDetails();

                                                calcDetailsAndTotals();

                                                updateHights();

                                                displayDetails();

                                    }

                        }
            }

            void getStuCode() throws IOException

            {

                        System.out.println(" =========== Student Input ===========");

                        System.out.print("Please enter the Student ID Code; ");

                        stuCode = Integer.parseInt(stdin.readLine());

            }

            void getStuDetails() throws IOException

            {

                        System.out.print("Please enter the number of hours worked; ");

                        hours = Integer.parseInt(stdin.readLine());

                        System.out.print ("Please enter the hourly pay rate; ");

                        hourlyPay = Float.parseFloat(stdin.readLine());

            }

            void displayDetails()

            {

                        System.out.println(" ");

                        System.out.println("Student Details: ");

                        System.out.println("=======================================");

                        System.out.println("Student Code: Code: " + stuCode);

                        System.out.println("Hours Worked: " + hours);

                        System.out.println("Hourly Pay: " + hourlyPay);

                        System.out.println("Gross Pay: " + grossPay);

                        System.out.println("Net Pay: " + netPay);

                        System.out.println("=======================================");

            }

            void calcDetailsAndTotals()

            {

                        //calculate for detail output

                        grossPay = hours * hourlyPay;

                     

                        if (hours > 25)

                        {

                                    grossPay = grossPay + ((hours - 25) * ((float)0.5 * hourlyPay));

                                    totOTHours = totOTHours + (hours - 25);

                        }

                        netPay = grossPay - (grossPay * deductionRate);

                        //calculate for report summary

                        totNetPay = totNetPay + netPay;

                        totGrossPay = totGrossPay + grossPay;

                     

                        totstus = totstus +1;

            }

            void updateHights()

            {

                        if (highHours < hours)

                        {

                                    highHours = hours;

                                    hiHoursStudent = stuCode;

                        }

            }

            void calculateAvg()

            {

                        avgGrossPay = totGrossPay / totstus;

            }

            void displaySummary()

            {

                        System.out.println(" ");

                        System.out.println("*GEST WEEKLY PAYROLL REPORT SUMMARY*");

                        System.out.println("=======================================");

                        System.out.println("Date: " + date);

                        System.out.println("Deductions Rate: " + deductionRate);

                        System.out.println("=======================================");

                        System.out.println("Total Net Pay: " + totNetPay);

                        System.out.println("Total OT Hours: " + totOTHours);

                        System.out.println("Average Gross Pay: " + avgGrossPay);

                        System.out.println("High Hours Worked: " + highHours);

                        System.out.println("High Hours Student: " + hiHoursStudent);

                        System.out.println("=======================================");
          
            }          

}

I have fixed your code. If you need to use array the codding structure needs to be changed. Please let me know if you need so.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote