It’s hard to measure the cost of code. Simple stuff can be ferociously time-consuming to develop, and bad coders often produce reams of poorly structured code.
But let’s assume you’re dealing with a typical, decent developer who doesn’t take the long route, or dangerous shortcuts.
There’s some nice research covering this, such as Boem, Abts Chulani  which is worth reading if you’re interested by this kind of stuff. But it’s heavy going, and doesn’t give a nice neat figure for lay people to understand.
So now I’m going to give the answer that many want to hear:
For each line of code produced in a 3GL non RAD environment the cost of your development is likely to come to around £20-£25 per line of new code. And about £100 per hundred lines of re-used code.
Doesn’t sound too bad… that includes testing, development, refinement, code reviews and so on. It’s based on the idea that most good developers can produce around 50-100 lines of code in a day if left alone and in peace. Some produce reams of code, but it’s often poorly optimised and thought out and likely to bite back in years to come. The cost also takes into account the design of that code before anyone touched a computer, and the various support staff required. If a developer is working entirely alone and is self-supported with his PCs and the like, then his productivity drops so the project takes longer, but the cost shouldn’t change too much.
And don’t forget that cheap code is often bulkier than expensive code. Which means nobody can look at a 1000 line program and actually say “Oh yeah, that’s £20k’s worth.” Somebody needs to assess the quality of that code.
What we will say is that in general, if we’ve written you 1000 lines of fresh code (ie, no cut and pasting or reuse) it could well have cost you £25k by the time it’s fully tested and delivered. A really big project, like, say, implementing a worldwide global payroll system for a major corporation may have five million lines of code and a final bill (including analysis) of around £125 million. Not at all unreasonable, believe it or not.
So yes, code is expensive. And that quick report you’d like us to knock up? Maybe it’s not so quick.
To save costs it’s worthwhile looking at RAD (Rapid Application Development) methods, but in that you’ll end up with slower, more bloated code. However, it can be a perfectly adequate approach and we use it all the time for simple data management back-ends and the like where performance isn’t that critical. Sometimes we’ll generate 20,000 lines of code from a three hour job… but it gets the job done. Albeit a little slowly!