Académique Documents
Professionnel Documents
Culture Documents
leave.Weneedafunctionwherewecanpassalist<>ofpunchesandhaveitreturnhowmanyminutes
thatemployeeworkedoneachdayrepresentedinthelist.
Herearethetwoclassesbeingused.Thepunchclassrepresentsthedate/timeforeachpunch.The
Daysrepresentthetotalminutesworkedinthatday(usingthepunchclasstodeterminethat)
So,ifanemployeehadthese4punches
9/1/20148:30AM
9/1/20144:30PM
9/3/20142:30PM
9/3/20146:30PM
ThefunctionImaskingyoutowritewouldreturntwodays
Day:9/1/2014TotalMinutes:480
Day:9/3/2014TotalMinutes:240
Twocaveats:
First,wearea24hourfacilityandweneedtocalculatethesenumbersperday.Soifsomeoneworksa
nightshiftwiththesepunches.
9/1/201410:00PM
9/2/20146:00AM
Then120minuteswouldbeaddedto9/1/2014and360minuteswouldbeaddedto9/2/2014
Second,peopletakelunchbreaks.Soifyouhaveascenariowith4punchesyoudcalculatebyfinding
thetimebetweenthefirsttwovaluesandthenthetimebetweenthesecondtwovalues.Thenthose
wouldbeaddedtogether.
ThisisthetestfunctionIamusingtogeneratepunches.Thesewilleventuallybetakenfromthe
database.ThisrepresentsthemainscenariosyoudneedtotestforsoIdsuggestusingittotestthe
codeyoudeliver.
ThisisthetestfunctionIamusingtogenerateresults(basedonthenumbersgivenabove).Thisisthe
functionIdneedyoutocreateandthehardcodedtestvaluesshouldmatchyourresults.
Thatsit.Ifyouhavequestionspleasefeelfreetocontactme.