|
namespace BusinessRules.Evolution_Four
{
/// <summary>
/// New Zealand Tax Engine Domain object specific to New Zealand tax rules.
/// </summary>
internal class NewZealandIncomeTaxEngine : IncomeTaxEngine
{
#region Methods
/// <summary>
/// Calculates the tax rate.
/// </summary>
/// <returns>
/// Returns a double representing the tax liability for the investor.
/// </returns>
public override Calculation<Investor> CalculateTaxRate()
{
return delegate(Investor investor)
{
double income = investor.Income;
if (income >= 0.0 && income <= 19500.99)
return 0.195;
else if (income >= 19501.00 && income <= 60000.99)
return 0.33;
else
return 0.39;
};
}
/// <summary>
/// Calculates the tax liability.
/// </summary>
/// <returns>
/// Returns a double representing the tax rate for the investor.
/// </returns>
public override Calculation<Investor> CalculateTaxLiability()
{
return delegate(Investor investor)
{
double taxLiability = 0.0;
double income = investor.Income;
if (income > 19500.99)
{
taxLiability += 19500.99 * 0.195;
}
if (income <= 19500.99)
{
taxLiability += income * 0.195;
}
if (income > 60000.99)
{
taxLiability += (60000.99 - 19501.00) * 0.33;
}
if (income >= 19501.00 && income <= 60000.99)
{
taxLiability += (income - 19501.00) * 0.33;
}
if (income > 60000.99)
{
taxLiability += (income - 60000.99) * 0.39;
}
return taxLiability;
};
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.