-
1 Attachment(s)
Help!
If anyone can give me the code for this I am willing to pay if it works.
[email protected]
You are required to produce a simplified payroll system for a fictional company. Each month a file is produced that contains the following information:
• Employee Name
• Employee National Insurance Number
• Grade 1 to 3
• (1=Staff, 2=Technical, 3=Manual)
• Hours worked
• Hourly pay rate
This file is attached as "employee.txt"
Your program will read in the data from the text file and process the data to produce a second file that contains:
• Employee Name
• National Insurance Number
• Gross Monthly Pay
• Monthly pension payment
• Monthly national insurance contribution
• Monthly income tax
• Total monthly net pay
Gross monthly pay is based on the hours worked and the rate of pay. Each employee has a standard 140-hour, calendar month. Staff grades do not have an enhanced overtime rate but technical employees have a 25% enhancement. Manual grades have a 50% enhancement for the first 40 hours overtime and a 100% enhancement for overtime above 40 hours.
Each employee pays a monthly pension equal to 7% of gross monthly pay, national insurance is payable at a rate of 8% on gross income after the pension contribution is removed.
All employees have a standard annual tax free allowance of £4, 800 after pension and national insurance have been deducted.
Tax is payable on any remaining income at the following annual national rates:
First £1, 750 @ 10%
Next £27, 250 @ 22%
Any remaining income over £29, 000 @ 40%
Your program will have a simple form containing one button to process the files. The contents of the file created must be shown in a textbox on the form.
The input file is called “employee.txt”
Input file:
"ALLEN A.B.","YZ123456",1,150,10.56
"BALDWIN E.F.","YZ234567",1,160,12.34
"CONWAY A.","AC765432",1,170,7.65
"DAVIS V.","AB564387",2,155,13.27
"EVANS Z.","YG547285",2,185,12.70
"FORD F.N.","YH529648",2,195,6.32
"GRIFFITHS N.","AG439846",3,140,15.32
"HOBBS J.","AB490190",3,200,8.56
"IMREY F.","AJ396834",3,205,5.25
"JONES M.","AK437645",2,148,16.20
"KNOWLES N.","AJ374924",1,183,8.34
"LEWIS D.","AK197843",1,210,5.76
IMPORTANT
In your code the location for the “employee.txt” file must be set to the a: drive (not c: or P:) and the file created must be called “payroll.txt” and written to the a: drive.
Some evidence of function decomposition is required to get a good mark.
Test Data
The correct output the for your program is shown below:
name NI_Number Gross_Pay Pension National_ins Tax Net_Pay
ALLEN A.B. YZ123456 £1,584.00 £110.88 £117.85 £192.66 £1,162.61
BALDWIN E.F. YZ234567 £1,974.40 £138.21 £146.90 £266.15 £1,423.15
CONWAY A. AC765432 £1,300.50 £91.04 £96.76 £139.30 £973.41
DAVIS V. AB564387 £2,106.61 £147.46 £156.73 £291.03 £1,511.39
EVANS Z. YG547285 £2,492.38 £174.47 £185.43 £363.64 £1,768.83
FORD F.N. YH529648 £1,319.30 £92.35 £98.16 £142.83 £985.96
GRIFFITHS N. AG439846 £2,144.80 £150.14 £159.57 £298.22 £1,536.87
HOBBS J. AB490190 £2,054.40 £143.81 £152.85 £281.20 £1,476.54
IMREY F. AJ396834 £1,312.50 £91.88 £97.65 £141.55 £981.42
JONES M. AK437645 £2,430.00 £170.10 £180.79 £351.90 £1,727.20
KNOWLES N. AJ374924 £1,526.22 £106.84 £113.55 £181.78 £1,124.05
LEWIS D. AK197843 £1,209.60 £84.67 £89.99 £122.19 £912.75
-
Re: Help!
theres no real point in someone here doing your homework for you..
why not give it a try yourself...and if you need help tweaking your code, then the forum members can help. :thumb:
-
Re: Help!
Welcome to the Forums.
Like Brian posted, there are not allot of people that will just "give me code" especially for a school project.
If you want to learn then you need to make an effort first and post questions and sample code of what your stuck on ;)
-
Re: Help!
OK I get you. just being a bit lazy. The main problem i am having is how to make access read the txt file and then apply all the formulae to it.
How do i refer to the different fields in the txt file?
I understand to open the file the code would be:
Open “c:\employee.txt” for Input as #1
And then to read actual data:
Input #1, variable1, variable2 ..
But as there is more than one line of data how do i move to the next line or specify exactly which field i want to extract?
This has made me stuck because i have the formulae code correct, but how do i apply it to a field i cannot refer to?
Thanks for any help.
-
Re: Help!
If you are pasring the text in VBA try having a look at the help files for :
Open (you've done this)
Line Input (or was it input Line?) <<<<< :D
Print
Close
EOF << sets to true if you are at the end of a file - requires the channel)
LOC << Position in file (by byte if I recall rightly)
Edit: and split (makes an array via a specified separator...)
You can open more than one channel at a time, so you can read in from one and output into another in the same chunk of code... Depending if you need to.