To the op. You asked how much should you charge.
I have done contract programming in the past. In fact that is how I have my current day job. If I had time and it was on ongoing deal, I usually took it easy on the client and charged $50 an hour. Which was pretty much equivalent to my overtime rate at my day job. If it was a quick job and nor nessesarily an ongoing deal, I would just charge what I though it was worth for my time and what the customer was willing to pay. Simple judgement and agreed upon before I started. But I would usually base it around $75-$100 an hour.
Programs are always delivered as is. No strings attached, no guarantee or warranty against a crash or quality issue. That is all on the customer unless they want me to prove it out (I have carried a liability policy when required to operate their machines). I never accept any liability on the quality end of things. The only thing I will do for the customer on that front is support them in making what they deem to be good quality parts. This support is free for quick edits, but back on the clock (at a reasonable rate) for in depth changes or on site changes.
So to put a short answer to you question. It depends on the situation, but just use common sense.
Oh and I have also done programming and engineering services for a percentage of value added sales, similar to commission. I doall the work up front on my own time, then collect a reasonable check for the life of the project. Overall it has worked out, I did three projects that way, only one of them has panned out so far, but it handily made up for the other time lost. 2.7% on a little less than a million a year in revenue isn't a bad return, especially for about a weeks worth of work to get it running and a few days here and there making improvements. Project is pretty much dead at the moment, but it ran for over a year and will come back eventually, and so will the checks.