|
namespace BusinessRules.Evolution_Two
{
/// <summary>
/// Investor Domain object that is abstract to form the base
/// for all other specific investor domain objects.
/// </summary>
public abstract class Investor : IInvestor
{
#region Fields
private double income;
#endregion
#region C'tors
/// <summary>
/// Initializes a new instance of the <see cref="Investor"/> class.
/// </summary>
/// <param name="income">The income.</param>
protected Investor(double income)
{
this.income = income;
}
#endregion
#region Factory Method
/// <summary>
/// Creates a new investor infered from the culture info.
/// </summary>
/// <param name="income">The investors income.</param>
/// <returns>Returns a specific investor for the current culture.</returns>
public static Investor CreateInvestor(double income)
{
ICurrentCultureInfo cultureInfo = new CurrentCultureInfo();
return CreateInvestor(cultureInfo, income);
}
/// <summary>
/// Creates a new investor infered from the culture info.
/// </summary>
/// <param name="cultureInfo">An instance of the current culture info.</param>
/// <param name="income">The investors income.</param>
/// <returns>Returns a specific income tax engine domain object.</returns>
public static Investor CreateInvestor(ICurrentCultureInfo cultureInfo, double income)
{
switch (cultureInfo.CurrentCultureName)
{
case "en-NZ":
return new NewZealandInvestor(income);
case "en-AU":
return new AustralianInvestor(income);
case "en-US":
return new USAInvestor(income);
default:
return new NullInvestor(income);
}
}
#endregion
#region Properties
/// <summary>
/// Gets or sets the income.
/// </summary>
/// <value>The income.</value>
public double Income
{
get { return income; }
set { income = value; }
}
/// <summary>
/// Gets the tax liability.
/// </summary>
/// <value>The tax liability.</value>
public abstract double TaxLiability { get; }
/// <summary>
/// Gets the tax rate.
/// </summary>
/// <value>The tax rate.</value>
public abstract double TaxRate { get; }
#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.