15,741,692 members
See more:
Hello sir,

I'm given a question to calculate employee salaries, where several grades of employee identified by the letters A-E and their pay rates are defined in a table

A XX X.XX X.XX
B XX X.XX X.XX
C XX X.XX X.XX
D XX X.XX X.XX
E XX X.XX X.XX

Employees are also associated with one of the following departments

DeptCode Dept Name
M Marketing
S Sales
R Research

You are to calculate:
1. total net pay for each department
2. total net pay for the whole company
3. total tax paid for the whole company.

Also u're required to produce a working C# program to produce a payroll report with the layout below:

Department: Marketing
ID Surname Forename Grade Hrs Gross Pay Tax Net Pay
0001 Crun Henry B 50 179.38 19.91 159.47
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
--------
Total for: Marketing xxxxx.xx

Department: Sales
ID Surname Forename Grade Hrs Gross Pay Tax Net Pay
0001 Crun Henry B 50 179.38 19.91 159.47
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
--------
Total for: Sales xxxxx.xx

Department: Research
ID Surname Forename Grade Hrs Gross Pay Tax Net Pay
0001 Crun Henry B 50 179.38 19.91 159.47
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
xxxx xxxxx xxxxxxx x xx xxx.xx xxx.xx xxx.xx
--------
Total for: Research xxxxx.xx
---------------------------------------------------------------------------
Totals for whole company:
Total Net Pay = xxxxxxx.xx
Total Tax Payable = xxxxxxx.xx

So far, I'v been able to calculate the
total net pay for marketing department only and also
total tax paid for marketing department

My question, how do I calculate for other departments sales and research total net pay and tex
and finally total net pay of the 3 department and total tax paid by the 3 department
thanks.

Thanks
Posted
Updated 7-May-11 0:45am
v2
NuttingCDEF 7-May-11 6:46am
Question edited to remove email address. When someone responds to this on CP you should get a notification - no need to publicise your email address to all the world's spammers! Note also that all responses will go via CP - as that way everyone benefits, not just you.
Richard MacCutchan 7-May-11 6:47am
Looks like a homework assignment. Computing the values for the other departments is exactly the same. It's just a question of maintaining totals for each employee, and each department. Try writing it out on paper first and then convert to code when you have got the concepts right.
NuttingCDEF 7-May-11 6:48am
Without some sample code he's tried we have no idea . . .
NuttingCDEF 7-May-11 6:48am
If you posted some of your code and gave a clue about what database structure you've used it might help someone make some helpful suggestions about how to solve your problem.

## Solution 1

A few simple rules that you should follow before posting a question here (the ones in bold are specifically for you) -

Have you searched or Googled for a solution?
Be specific! Don't ask "I need to write a booking application". Specify exactly what it is you need help with.
Keep the subject brief but descriptive. eg "How do I change the dialog colour?"
Keep the question as concise as possible. If you have to include code, include the smallest snippet of code you can - do not dump your entire codebase.
Your question may be edited or retagged by others. Anything inappropriate will be removed.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read.
Do not be abusive, offensive, inappropriate,harass anyone on the boards or post ads or spam. Doing so will get you kicked off and banned. Play nice.

Richard MacCutchan 7-May-11 6:52am
I think, to be fair, the OP has indicated that he has completed part of the assignment. I modified my original comment to take this into account.

Top Experts
Last 24hrsThis month
 OriginalGriff 90 Richard MacCutchan 60 Gerry Schmitz 25 Rick York 20 honey the codewitch 10
 OriginalGriff 1,568 Richard MacCutchan 1,318 merano99 480 Rick York 430 Dave Kreskowiak 276

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900