Pricing fixed-price software projects with integer arithmetic
A fixed-price contract has two numbers: what the customer pays and what the developer retains. Confusing them creates a budget error before a single line of application code is written. This tutorial builds a small, testable pricing model in Python. It uses integer cents, explicitly models a minimum service fee, and turns a target net amount into the smallest conservative quote. All amounts and…
In a fixed-price software contract, two numbers matter: the amount the customer pays and the portion the developer keeps. Misunderstanding these figures can cause budget errors before any code is written. This tutorial demonstrates a pricing model in Python that uses integer cents, explicitly includes a minimum service fee, and adjusts the quote to meet a target net amount. Throughout, all figures are illustrative and not recommendations.
1. Begin with the work, not the marketplace. Consider a developer quoting a small dashboard integration. The work breaks down into 28 hours: 3 for discovery and acceptance criteria, 9 for API integration, 8 for testing and deployment, and 3 for delivery and handover. At an internal target of $40 per hour, the developer expects $1,120 after accounting for a service fee.
Adding a $80 allowance for scope uncertainty raises the target to $1,200. The $80 is not a substitute for a change-control clause but serves as a planning buffer for uncertainty within the defined scope. Other costs like taxes, currency conversion, and hosting expenses are excluded from this simplified example and should be added separately if applicable.
2. Assume a service fee of 12%. Quoting $1,200 to the customer would leave $1,056 after the fee. Applying a 12% fee to the target results in a quote of $1,344, which leaves $1,182.72 short. Instead, divide the target by the retained fraction (1 - fee) to find the gross amount: gross = 1200 / (1 - 0.12) = 1363.636363... Round up to $1,363.64. The extra precision is crucial because the objective is a minimum, not an average.
3. Define the fee contract explicitly. Separate the accounting policy from the user interface. Represent money as integer cents and percentages as basis points (1% = 100 basis points). The fee is the larger of the percentage fee (rounded up) or a specified minimum. Ensure the fee rate is less than 100%. Both mathematical requirements—Gross minus fee equals Net and Gross minus minimum equals Net—must hold true.
Using integer cents, compute the gross price as the larger of N / (1 - r) and N + Minimum, avoiding binary floating point.
4. Implement the calculator. Use Python's dataclasses to create a FeeModel class with methods to calculate the fee, net amount, and quote. The fee method rounds up the fee based on the gross amount and fee rate. The net method subtracts the fee from the gross. The quote method determines the minimum amount needed to reach the target net after accounting for the fee. To ensure the fee-floor boundary, test various rates and targets, verifying that the quote and net calculations remain accurate.
In essence, this model provides a reproducible method for quoting fixed-price software projects, ensuring that the developer's target net amount is met with minimal overruns. By adhering to integer arithmetic, the model avoids common pitfalls associated with floating-point calculations, providing a robust framework for pricing contracts.
Rewritten by urgent.news; may contain errors — check the original.