My inital suggestion would be to calculate everything in minutes. Then you are always dealing with whole numbers, so you never calculate a total of 3.955555555555 for someone's bill. I have built large-scale billing systems for a few companies, and the first thing you learn is that you never calculate anything as a float that you can calculate as an int.
Next off, you cannot use modulo division (the %) on a float because there is no remainder when dividing floats. They are floating point numbers, so 7.0/3.0 = 2.333333, not 2 remainder 1.
Let me know if you need some more help, other than my random points of style.
|