|
namespace BusinessRules.Evolution_Three
{
/// <summary>
/// Investor Business Rules Domain object that is abstract to form the base
/// for all other specific business rules domain objects.
/// </summary>
public abstract class IncomeTaxEngine : IIncomeTaxEngine
{
#region Factory Method
/// <summary>
/// Creates the specific instance of the income tax engine domain object
/// dependant on the current culture.
/// </summary>
/// <returns>Returns a specific income tax engine domain object.</returns>
public static IIncomeTaxEngine CreateInstance()
{
ICurrentCultureInfo cultureInfo = new CurrentCultureInfo();
return CreateInstance(cultureInfo);
}
/// <summary>
/// Creates the specific instance of the income tax engine domain object
/// dependant on the current culture.
/// </summary>
/// <param name="cultureInfo">An instance of the current culture info.</param>
/// <returns>Returns a specific income tax engine domain object.</returns>
public static IIncomeTaxEngine CreateInstance(ICurrentCultureInfo cultureInfo)
{
switch (cultureInfo.CurrentCultureName)
{
case "en-NZ":
return new NewZealandIncomeTaxEngine();
case "en-AU":
return new AustralianIncomeTaxEngine();
case "en-US":
return new UsaIncomeTaxEngine();
default:
return new NullIncomeTaxEngine();
}
}
#endregion
#region Methods
/// <summary>
/// Calculates the tax liability.
/// </summary>
/// <param name="income">The investor.</param>
/// <returns>
/// Returns a double representing the tax rate for the investor.
/// </returns>
public abstract double CalculateTaxLiability(double income);
/// <summary>
/// Calculates the tax rate.
/// </summary>
/// <param name="income">The investor.</param>
/// <returns>
/// Returns a double representing the tax liability for the investor.
/// </returns>
public abstract double CalculateTaxRate(double income);
#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.