I have working on the the expansion of a payroll system for a project for about a month now ad I just recent ran into a some trouble.
The program in is working, but I am having difficulty trying to get Calculate the averages of information in the program.
What I am trying to do is Calculate the average of all employee net pays (salary) and I am also trying to Display the computations and average of at least 5 employees.
Your code is pretty much unreadable without reasonable indentation and code tags.
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
What does an instance of a payroll object represent? An employee? Or a payroll system?
You seem to be mixing the two. findavgnetpay() is not going to work the way you want. Where you have the call to findavgnetpay(), you've already passed over all the employees in the file.
I strongly recommend that you implement payroll and employee in separate classes.
You can do what you want after calculatenetpay() by adding each employee's net pay to totalnetpay. Then after the while, compute avgnetpay by dividing totalnetpay by the number of employees.