You have a customer. They want you to make some software. They have a cool idea/vision. So they ask you... 'how much will it cost?'. The maths is simple..
Total cost = costPerDeveloperPerWeek * NumberOfDevelopers *
With XP the customer is asked to define requirements as stories. Each story consists of a description, an estimate of business value, and an estimate of complexity.
The stories are sorted in order of decreasing business value.
How many points can a developer get done in a week? Say its 1.
Say 1 week of work for a developer costs $2000 then 1 point/wk = $2000.
How much is the customer willing to spend each week? $6000 = 3 developers.
This then sets the amount of work done each week. You can now chunk the stories up into 3 point groups(iterations).
Evaluating business value of each iteration should allow the customer to decide at what point in the development cycle the customer is not getting enough value for their money to continue development. Alternativly they can see how much functionality they will have before their money runs out.
Problems: How do you know the velocity of the team (and hence the rate per developer)?
Experience is the only solution. If you have worked with the team before, then you can use those figures to start with. If not then make something up, and re-evaluate the situation after 3 iterations when you have some measurable statistics.