wogdog2000
Jul 11, 2009, 05:16 AM
if someone could start me off and ill finish the rest, that would be great.
Q1. In this question you have to desk check what this piece of code is doing. It calculates the number of hours that an employee works by reading the .txt files produced by the fingerprint reader.
SUB CalcHours ( IDnumber AS INTEGER, PaidHours (1 TO 7) AS SINGLE, PayDate AS STRING)
DIM FileName AS STRING
DIM FileNum AS INTEGER
DIM hours AS INTEGER
DIM day AS INTEGER
FileName = "E:\" + LTRIM$(STR$(IDnumber)) + ".txt"
FileNum = FREEFILE
OPEN FileName FOR INPUT AS #FileNum
LINE INPUT #FileNum, PayDate
LINE INPUT #FileNum, a$
FOR day = 1 TO 7
INPUT #FileNum, in1$
INPUT #FileNum, out1$
INPUT #FileNum, in2$
INPUT #FileNum, out2$
IF in1$ <> "-" THEN
hours = VAL(LEFT$(out1$, 2)) - VAL(LEFT$(in1$, 2))
PaidHours(day) = hours * 60 + VAL(RIGHT$(out1$, 2)) - VAL(RIGHT$(in1$, 2))
ELSE
PaidHours(day) = 0
END IF
IF in2$ <> "-" THEN
hours = VAL(LEFT$(out2$, 2)) - VAL(LEFT$(in2$, 2))
PaidHours(day) = PaidHours(day) + hours * 60 + VAL(RIGHT$(out2$, 2)) - VAL(RIGHT$(in2$, 2))
END IF
PaidHours(day) = PaidHours(day) / 60
NEXT
CLOSE
END SUB
a) Perform a desk check on this subroutine, using the fingerprint file from above (1005.txt) with the following headings:
day in1 out1 in2 out2 hours PaidHours(day)
its supposed to be in a table
the 1005.txt is under here
6 April 2008 this is when he worked
Marcus Fixit this is his name
0730, 1145, 1245, 1600 this is what time he workes on Monday the times in the middle is his brakes so here it is from 11:45 to 12:45
0800, 1215, 1245, 1715 this is what time he workes on Tuesday
0815, 1200, 1245, 1730 this is what time he workes on Wednesday
0811, 1155, 1233, 1700 this is what time he workes on Thursday
-, -, -, - he did not work.
0747, 1210, -, - today he only worked from 7:47 to 12:10.
-, -, -, - he did not work
this the hours that his guy worked and when he worked and his name.
any questions to do with this just reply to the question
Q1. In this question you have to desk check what this piece of code is doing. It calculates the number of hours that an employee works by reading the .txt files produced by the fingerprint reader.
SUB CalcHours ( IDnumber AS INTEGER, PaidHours (1 TO 7) AS SINGLE, PayDate AS STRING)
DIM FileName AS STRING
DIM FileNum AS INTEGER
DIM hours AS INTEGER
DIM day AS INTEGER
FileName = "E:\" + LTRIM$(STR$(IDnumber)) + ".txt"
FileNum = FREEFILE
OPEN FileName FOR INPUT AS #FileNum
LINE INPUT #FileNum, PayDate
LINE INPUT #FileNum, a$
FOR day = 1 TO 7
INPUT #FileNum, in1$
INPUT #FileNum, out1$
INPUT #FileNum, in2$
INPUT #FileNum, out2$
IF in1$ <> "-" THEN
hours = VAL(LEFT$(out1$, 2)) - VAL(LEFT$(in1$, 2))
PaidHours(day) = hours * 60 + VAL(RIGHT$(out1$, 2)) - VAL(RIGHT$(in1$, 2))
ELSE
PaidHours(day) = 0
END IF
IF in2$ <> "-" THEN
hours = VAL(LEFT$(out2$, 2)) - VAL(LEFT$(in2$, 2))
PaidHours(day) = PaidHours(day) + hours * 60 + VAL(RIGHT$(out2$, 2)) - VAL(RIGHT$(in2$, 2))
END IF
PaidHours(day) = PaidHours(day) / 60
NEXT
CLOSE
END SUB
a) Perform a desk check on this subroutine, using the fingerprint file from above (1005.txt) with the following headings:
day in1 out1 in2 out2 hours PaidHours(day)
its supposed to be in a table
the 1005.txt is under here
6 April 2008 this is when he worked
Marcus Fixit this is his name
0730, 1145, 1245, 1600 this is what time he workes on Monday the times in the middle is his brakes so here it is from 11:45 to 12:45
0800, 1215, 1245, 1715 this is what time he workes on Tuesday
0815, 1200, 1245, 1730 this is what time he workes on Wednesday
0811, 1155, 1233, 1700 this is what time he workes on Thursday
-, -, -, - he did not work.
0747, 1210, -, - today he only worked from 7:47 to 12:10.
-, -, -, - he did not work
this the hours that his guy worked and when he worked and his name.
any questions to do with this just reply to the question