Note: This is a general programming question, not specific to any language, but feel free to use the language of your choice in your answer to explain the logic.
I would like a method to take a string of text, say "Default(0-100)=20"
and then extract out of that the default hourly wage would be 20 for hours 0 through 100. This could be then used for say "Default(101-245)=25" that the default hourly wage for hours 101 through 245 would be 25. Also allow it to define "Brian(0-29)=15" that the user "Brian" would have an non-default hourly wage of 15 for hours 0 through 29.
My first impression is to run the string through a regular expression says something like ^(\w*)\((\d*)-(\d*)\)$
where it could pickup the Text and the smaller and higher end of the range.
What would be the best way to store this information so it could be used later on? multidimensional array? hashes?
Once you do have the information stored, what would be the best way of actually using the information to good use?
How would you calculate the total wages earned if say we used "Default(0-100)=20"
& "Default(101-245)=25"
and the number of hours worked was 150.