Write a program that allows the user to do a payroll listing on any number of employees, up to a maximum of 20, for a one week period. This program must be written using arrays, classes and methods. The program is to be broken into various tasks; each task will be coded as a method. Each method will be passed arguments and will return a value.
Several arrays will be used in the program; no array will exceed 20 elements. One array will hold the employee numbers that are input. Other arrays will hold the Computed Gross Pay, Computed Income Tax and Computed Net Pay values. When the user indicates he/she wishes to stop the input of employee data, the program will display a list of employee numbers, and the corresponding computed values, plus a total for each of the computed values.
The following shows a sample run of the program with user inputs in boldface.
>payroll
Enter Employee Number : 123-45-6789
Enter Regular Hours Worked : 40
Enter Overtime Hours Worked : 0
Enter Hourly Pay Rate : 15.00
Enter Marital Status (M or S) : M
Enter number of Exemptions taken (0-4) : 2
Computed Gross Pay : P600.00
Computed Income Tax :-P126.90
---------------
Computed Net Pay : P473.10
Do you wish to do another(Y/N)? Y
Enter Employee Number : 234-56-7890
Enter Regular Hours Worked : 40
Enter Overtime Hours Worked : 0
Enter Hourly Pay Rate : 20.00
Enter Marital Status (M or S) : S
Enter number of Exemptions taken (0-4) : 0
Computed Gross Pay : P800.00
Computed Income Tax :-P217.50
---------------
Computed Net Pay : P582.50
Do you wish to do another(Y/N)? N
Employee Payroll Roster
Employee Gross Deductions Net
Number Pay Pay
---------- --------- --------- ----------
123-45-6789 P 600.00 P 126.90 P 473.10
234-56-7890 P 800.00 P 217.50 P 582.50
--------- --------- ----------
Totals P1400.00 P 344.40 P 1055.60
Employee Number is declared as a variable and assigned a value by the user as each employee's data is processed. Character Data.
Regular Hours Worked is declared as a variable and is input by the user as each employee's data is processed. Integer Data.
Overtime Hours Worked is declared as a variable and is input by the user as each employee's data is processed. Integer Data.
Hourly Pay Rate is declared as a variable and is input by the user as each employee's data is processed. Float Data.
Marital Status is declared as a variable and is input by the user as each employee's data is processed. Only M or S may be input.
‘Exemptions’ is declared as a variable and is input by the user as each employee's data is processed. This is the number of tax exemptions the employee is taking. In this program, the only allowable value for exemptions is 0 thru 4. Integer Data.
Weekly Gross Pay is a computed value derived from Regular Hours Worked multiplied by Hourly Pay Rate plus Overtime Hours Worked multiplied by the product of Hourly Pay Rate multiplied by 1.5.
‘Deductions’ is a computed value to indicate the amount of tax deductions needed to be subtracted from the Adjusted Gross Pay. Adjusted Gross Pay is computed by taking the number of Exemptions an employee has and multiplying that by P13.50. This amount is then subtracted from the Weekly Gross Pay amount to give Adjusted Gross Pay. Adjusted Gross Pay is then used to determine the amount of income tax owed. The following indicates how to calculate the income tax amounts based on the Adjusted Gross Pay.
For Married Employees:
Of Amount
Adjusted Gross Pay Income Tax Over
------------------ ------------ ---------------
P0.00 - P100 10% P 50.00
P101 - P300 P 20.00 + 20% P 150.00
P301 - P600 P 60.00 + 30% P 350.00
P601 - P9999 P180.00 + 50% P 650.00
For Single Employees:
Of Amount
Adjusted Gross Pay Income Tax Over
------------------ ------------ ---------------
P0.00 - P100 10% P 50.00
P101 - P300 P 20.00 + 10% P 150.00
P301 - P600 P 60.00 + 15% P 350.00
P601 - P9999 P180.00 + 25% P 650.00
Weekly Net Pay a computed amount showing the take home or net pay for the employee. Weekly Net Pay is computed by subtracting Deductions from Weekly Gross Pay.
When all employees’ payroll data has been processed, display the totals for gross pay, deductions and net pay.
Each numeric value displayed on the screen should be formatted using output formatting code. After the user enters each value, rewrite it to the screen in proper format so that all entries will be aligned in columns.