If you had written it according to the principles and customs of object-oriented programming, that would now be such an easy assignment. You would have an Employee class, which you might have to add getGrossPay() or getOvertimePay() methods to. In real life, you would have a List of weeks worked in the Employee class, but here you are only working out one week’s wages. So your class might well be called WeekWorked, or similar. As I said, with getGrossPay() and getOvertimePay() methods. You can get that stub from a toString() method.
I think you have gone about this exercise quite the wrong way, I am afraid. I think you need a class, like this:-
Now a method to
test it
. . . which I have written so you
must call it like this
java PayDemo Campbell Ritchie 42.5 1000000.00 99
. . . at the command line, otherwise you will suffer Exceptions. The correct working of that method depends on the arguments going in the correct order; you might need to change the order of the constructor parameters, and also on WeekWorked having a suitably-overridden toString() method.
I am not sure that gross pay is actually hours worked × pay rate. It is (hours worked up to 40) × pay rate + (hours worked over 40) × 1.5 × pay rate. I think you need a getBasicPay() method instead of getGrossPay; gross pay = basic pay + overtime pay.
Now you can work out how to write that WeekWorked object to a text file. And also how to get the data from a text file. When you have several records in a text file, you will need a loop to read them in turn. Loop, read from the file, create your WeekWorked object, write it to the output file, then back to the start of the loop.