From: Joop Van den tillaart Date: 2007-08-31T21:08:59+09:00 Subject: Program which calculates earnings (with some difficulties).. Hi you all, I have a 'problem' which I cannot solve using spreadsheet software like Excel. The problem involves some little program I want to make which can calculate my earnings of a days work by just inserting the time I start working and the time I stop working. Because I work with different earning percentages during a day this isn't as easy as it sounds (at least not for me). I tried some different approaches in Excel but couldn't get it to work the way I wanted it to. I had a project once with some work done in Ruby (mostly NOT done by me so I'm not a pro at Ruby :D) and now I thought maybe you Ruby experts can come up with an idea to get this done. Here are the percentages: Hours between: 00:00 - 05:00 = earnings per hour * 1.85 (night shift) Hours between: 05:00 - 07:00 = earnings per hour * 1.35 (early morning shift) Hours between: 07:00 - 16:00 = earnings per hour * 1.00 (day shift) Hours between: 16:00 - 18:00 = earnings per hour * 1.35 (late afternoon shift) Hours between: 18:00 - 00:00 = earnings per hour * 1.60 (evening shift) An extra dimension to the problem is added because of the fact that after each 4 hours I work, half an hour (work break) of the earnings per hour * percentage (percentage of the 4 hours worked) is not being paid. So these unpaid breaks are also variable in percentage. I need a solution where I can input my starting time and ending time and which calculates my earnings during these hours (working day). Also I (or the program ;-)) need(s) to be able to put in different starting times and ending times because I work with a very variable/fluctuating working schedule... Maybe it's a long story but I hope you guys understand what I mean and maybe some of you experts see a way of how to do this in Ruby. Please let me know then and I would be higly grateful!! Thanks in ADVANCE!!! Greets, tillaart36! -- Posted via http://www.ruby-forum.com/.