Okay i need some help doing a payroll system using master/transaction files in C++. I have done the pseudocode (we will use text files to simulate tapes)
can anyone see any probs with my pseudocode?
how would i do it in c++?
========================
get payroll transaction file for $month (id, hours_worked_this_month)
get master file for $year (id,name,payrate,total_hours_this_year)
where transaction.id = master.id then
total_hours_this_year = total_hours_this_year + hours_worked_this_month
COPY TO NEW MASTER FILE
NEXT transaction.ID
UNTIL EOF (end of file)
COPY ALL (UNMODIFIED) RECORDS TO NEW MASTER FILE TOO
END
========================
[B]e.g?[/B]
[B]transaction file sample for DECEMBER:[/B]
id = 1, hours_worked_this_month = 29
id = 3, hours_worked_this_month = 54
id = 4, hours_worked_this_month = 48
id = 9, hours_worked_this_month = 12
[B]master file sample for 2007:[/B]
id = 1, name = james, payrate = £5.70, total_hours_this_year = 1028
id = 2, name = bob, payrate = £3.70, total_hours_this_year = 5021
id = 3, name = jane, payrate = £2.75, total_hours_this_year = 2022
id = 4, name = alex, payrate = £5.00, total_hours_this_year = 1128
id = 5, name = mike, payrate = £3.50, total_hours_this_year = 1121
id = 6, name = steve, payrate = £8.80, total_hours_this_year = 1017
id = 7, name = alan, payrate = £9.78, total_hours_this_year = 2078
id = 8, name = jeff, payrate = £23.75, total_hours_this_year = 3328
id = 9, name = mary, payrate = £32.70, total_hours_this_year = 4628
id = 10, name = kris, payrate = £15.00, total_hours_this_year = 5228
[B]Okay, now these recirds will be merged into the new master file where the IDs match:[/B]
id = 1, hours_worked_this_month = 29
++++++++++
id = 1, name = james, payrate = £5.70, total_hours_this_year = 1028
id = 3, hours_worked_this_month = 54
++++++++++
id = 3, name = jane, payrate = £2.75, total_hours_this_year = 2022
id = 4, hours_worked_this_month = 48
++++++++++
id = 4, name = alex, payrate = £5.00, total_hours_this_year = 1128
id = 9, hours_worked_this_month = 12
++++++++++
id = 9, name = mary, payrate = £32.70, total_hours_this_year = 4628
[B]to make a new master file (the hours for that month are added onto the total)[/B]
id = 1, name = james, payrate = £5.70, total_hours_this_year = 1057
id = 3, name = jane, payrate = £2.75, total_hours_this_year = 2076
id = 4, name = alex, payrate = £5.00, total_hours_this_year = 1173
id = 9, name = mary, payrate = £32.70, total_hours_this_year = 4640
[B]then the unedited files are merged into the new master file[/B]
id = 1, name = james, payrate = £5.70, total_hours_this_year = 1057
id = 3, name = jane, payrate = £2.75, total_hours_this_year = 2076
id = 4, name = alex, payrate = £5.00, total_hours_this_year = 1173
id = 9, name = mary, payrate = £32.70, total_hours_this_year = 4640
id = 2, name = bob, payrate = £3.70, total_hours_this_year = 5021
id = 5, name = mike, payrate = £3.50, total_hours_this_year = 1121
id = 6, name = steve, payrate = £8.80, total_hours_this_year = 1017
id = 7, name = alan, payrate = £9.78, total_hours_this_year = 2078
id = 8, name = jeff, payrate = £23.75, total_hours_this_year = 3328
id = 10, name = kris, payrate = £15.00, total_hours_this_year = 5228
[B]IGNORE THE IDS BEING IN ORDER, THEY WONT BE AN DONT HAVE TO BE BECAUSE WE GO TO THE END OF THE FILE??? - I MADE A MISTAKE[/B]