Question: JAVA reading in files you should make a java program that read in a text file name empldata. Each line of the file contains two
JAVA reading in files
you should make a java program that read in a text file name empldata. Each line of the file contains two data items: hours and rate. The hours represents the number of hours that an employee worked during the week, the rate represents the hourly rate of pay { ex: if line of data contains 11 24.00, that means employee worked 11 hours at an hourly rate of 24.00 per hour}
the first item of the data is a count indicating how many lines of data are to follow.
Data file
6 <-------- is the count indicating how many line of data are to follow
10 25.00 <-----hours and rate
5 50.00
50 30.00
65 45.00
80 15.00
25 10.00
gross: method accepts the number of hours worked and the rate of pay. The function return the dollar and cent amount of the amount earned as follows. Employee who work 40 hours or less are paid at their regular rate. employees who work in excess of 40 hours in a single week are paid at their regular rate for the first 40 hours and at 150% of their rate for hours in excess of 40. Example an employee is paid at the rate of 10.00/hour. if employee works for 30 hours he will be paid 30*10 (=300.00); if employee works for 50 hours he will be paid 40*10+10*15(=550)
tax: this function accepts a gross pay amount and calculates the taxes on that amount.
amount under $200 no tax
amount between 200 and 500 rate of 5%
amount between 500 and 1000 rate of 6%
amount in excess of 1000 rate of 10%
main method: declare all variables, files and opens files. process the empldata file as follows: read the count for each line of data, read the number of hours worked and the employee rate. compute the gross pay ( call the function) compute the tax (call the function) compute the net pay. print the following: hours, rate, gross pay , tax , net pay.
after all the employess has been process, print the following
total number of employess processed
average gross pay
number of employees who paid no tax
number of employees at the highest bracket
average tax paid of all employess
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
