Question: JAVA Write a Payroll class that uses the following arrays as fields: employeeID An array of seven integers to hold employee identification numbers. The array

JAVA

Write a Payroll class that uses the following arrays as fields: employeeID An array of seven integers to hold employee identification numbers. The array should be initialized with the following numbers:

5658845 4520125 7895122 8777541 8451277 1302850 7580489

hoursWorked An array of seven integers to hold the number of hours worked by each employee

payRate An array of seven doubles to hold each employees hourly pay rate

grossPay An array of seven doubles to hold each employees gross wages

All 4 arrays should be private data members of the class.

Give the arrays memory in your constructor.

Initilaize the employID array, as stated above, in your constructor.

2 Methods (in addition to your constructor):

public void populateEmpData()

inside this method, have a for loop that iterates through your employID array.

on each iteration, your output to the user should display the employID and ask for hours, and then pay rate.

You should be populating your other arrays with this data you receive, accordingly.

On each iteration, you can also do the multiplication for the grossPay and populate that array.

When the for loop is done, your other 3 arrays should, therefore, be fully populated.

public void printEmpData()

inside this method, have a for loop that iterates through your arrays and nicely outputs all the data (from each of the 4 arrays).

Employee ID: xxxxxx

Hours Worked: xxxx

Pay Rate: xxxx

Gross Pay:

Your MainClass main() should instatiate the Payroll object, and then call the two methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!