Talismanic
Registered User.
- Local time
- Today, 01:24
- Joined
- May 25, 2000
- Messages
- 377
I have strings that can be any combination of the following:
HHHHHHHD
HHHXHHHD
HHHHDDDD
I need to be able to parse them into meaniful messages to the user. This is very complicated so I am going to post the rules along with this (It's a brain teaser).
Overtime is represented as a eight character code. Each character represents a certain period of time after the first 8 hours Monday thru Friday.
Overtime for Monday thru Friday after 8 hours:
the 1st character is for time worked in the 9th hour (8.1 - 9 hours)
the 2nd character is for time worked in the 10th hour (9.1 - 10 hours)
the 3rd character is for time worked beyond the 10th hour (10.1 and beyond)
Overtime on Saturday:
the 4th character is for time worked in the first 8 hours on Saturday (0-8 hours)
the 5th character is for time worked in the 9th hour on Saturday (8.1 - 9 hours)
the 6th character is for time worked in the 10th hour (9.1 - 10 hours)
the 7th character is for time worked beyond the 10th hour (10.01 and beyond)
Overtime on Sundays & Holidays
The 8th character is for time worked on Sunday or on a holiday
The last character indicates if an optional 4 day 10 hour per day work week can worked without paying overtime after 8 hours worked.
2. OVERTIME INDICATORS USED IN THE OVERTIME PROVISION.
H - means TIME AND ONE HALF due
X - means TIME AND ONE HALF due after 40 HOURS worked
D - means DOUBLE PAY due
Y - means YES
N - means NO
This is an example of what I have to get to:
HHHHHHHDN- this example shows the 1½ rate must be used for time worked after 8 hours Monday thru Friday (characters 1-3); 1½ is also due for all hours worked on Saturday (characters 4-7). Work done on Sundays or Holidays must be paid double time (character 8 (not shown)).
What is the best way to go about this? I am not really looking for some one to write my code I am more interested in the logic that should be put in place. Although I wouldn't mind if some one could show me how to parse the string one character at a time.
[This message has been edited by Talismanic (edited 08-03-2001).]
HHHHHHHD
HHHXHHHD
HHHHDDDD
I need to be able to parse them into meaniful messages to the user. This is very complicated so I am going to post the rules along with this (It's a brain teaser).
Overtime is represented as a eight character code. Each character represents a certain period of time after the first 8 hours Monday thru Friday.
Overtime for Monday thru Friday after 8 hours:
the 1st character is for time worked in the 9th hour (8.1 - 9 hours)
the 2nd character is for time worked in the 10th hour (9.1 - 10 hours)
the 3rd character is for time worked beyond the 10th hour (10.1 and beyond)
Overtime on Saturday:
the 4th character is for time worked in the first 8 hours on Saturday (0-8 hours)
the 5th character is for time worked in the 9th hour on Saturday (8.1 - 9 hours)
the 6th character is for time worked in the 10th hour (9.1 - 10 hours)
the 7th character is for time worked beyond the 10th hour (10.01 and beyond)
Overtime on Sundays & Holidays
The 8th character is for time worked on Sunday or on a holiday
The last character indicates if an optional 4 day 10 hour per day work week can worked without paying overtime after 8 hours worked.
2. OVERTIME INDICATORS USED IN THE OVERTIME PROVISION.
H - means TIME AND ONE HALF due
X - means TIME AND ONE HALF due after 40 HOURS worked
D - means DOUBLE PAY due
Y - means YES
N - means NO
This is an example of what I have to get to:
HHHHHHHDN- this example shows the 1½ rate must be used for time worked after 8 hours Monday thru Friday (characters 1-3); 1½ is also due for all hours worked on Saturday (characters 4-7). Work done on Sundays or Holidays must be paid double time (character 8 (not shown)).
What is the best way to go about this? I am not really looking for some one to write my code I am more interested in the logic that should be put in place. Although I wouldn't mind if some one could show me how to parse the string one character at a time.
[This message has been edited by Talismanic (edited 08-03-2001).]