예제 #1
0
 public static IEnumerable <StampDutyBand> CalculateStampDuty(double price, bool isSecondHome)
 {
     if (isSecondHome)
     {
         return(StampDutyCalculatorHelper.CalculateResidentialSecondHome(price));
     }
     return(StampDutyCalculatorHelper.CalculateResidentialHome(price));
 }
예제 #2
0
        public static void Start()
        {
            while (true)
            {
                Console.WriteLine("Is the property Residential or Non-Residential");
                Console.WriteLine("1: Residential. ");
                Console.WriteLine("2: Non-Residential");
                var msg  = $"[Enter option number:] (1 or 2)";
                var type = StampDutyHelper.GetInputFromConsole(1, 2, msg);
                if (type == 1)
                {
                    var residentialPropertyInfo = new List <KeyValuePair <string, string> >();
                    Console.WriteLine("What is the Residential Property Value:");
                    var propertyValue = Convert.ToDouble(System.Console.ReadLine());
                    residentialPropertyInfo.Add(new KeyValuePair <string, string>("Value", propertyValue.ToString(CultureInfo.InvariantCulture)));

                    Console.WriteLine("Is property Freehold?");
                    Console.WriteLine("(1) Freehold  ");
                    Console.WriteLine("(2) Leasehold ");
                    var freehold = StampDutyHelper.GetInputFromConsole(1, 2, msg);
                    residentialPropertyInfo.Add(freehold == 1 ? new KeyValuePair <string, string>("Holding", "Freehold") : new KeyValuePair <string, string>("Holding", "Leasehold"));

                    Console.WriteLine("Is property Joined Owned? ");
                    Console.WriteLine("(1) Joined ");
                    Console.WriteLine("(2) Not Joined ");
                    var joined = StampDutyHelper.GetInputFromConsole(1, 2, msg);
                    residentialPropertyInfo.Add(joined == 1 ? new KeyValuePair <string, string>("Ownership", "Joined") : new KeyValuePair <string, string>("Ownership", "Sole Owner"));

                    Console.WriteLine("Is property SecondHome?");
                    Console.WriteLine("(1) FirstHome");
                    Console.WriteLine("(2) SecondHome ");

                    var secondHome = StampDutyHelper.GetInputFromConsole(1, 2, msg);
                    if (secondHome == 2)
                    {
                        var value  = residentialPropertyInfo.Find(x => x.Key == "Value").Value.ToString();
                        var result = StampDutyCalculatorHelper.CalculateResidentialSecondHome(Convert.ToDouble(value));
                        residentialPropertyInfo.Add(new KeyValuePair <string, string>("Additonal Property", "Yes"));
                        StampDutyHelper.PrintTax(result);
                    }
                    else
                    {
                        var value  = residentialPropertyInfo.Find(x => x.Key == "Value").Value.ToString();
                        var result = StampDutyCalculatorHelper.CalculateResidentialHome(Convert.ToDouble(value));
                        residentialPropertyInfo.Add(new KeyValuePair <string, string>("Ownership", "No"));
                        StampDutyHelper.PrintTax(result);
                    }
                }
                else
                {
                    var nonresidentialPropertyInfo = new List <KeyValuePair <string, string> >();

                    Console.WriteLine("Non-Residential Property Value:");
                    var propertyValue = Convert.ToDouble(Console.ReadLine());
                    nonresidentialPropertyInfo.Add(new KeyValuePair <string, string>("Value", propertyValue.ToString(CultureInfo.InvariantCulture)));

                    Console.WriteLine("Is property Freehold? (1) Freehold (2) Leasehold ");
                    Console.WriteLine("(1) Freehold");
                    Console.WriteLine("(2) Leasehold");

                    var freehold = StampDutyHelper.GetInputFromConsole(1, 2, msg);

                    nonresidentialPropertyInfo.Add(new KeyValuePair <string, string>("Holding", "Leasehold"));
                    var value  = nonresidentialPropertyInfo.Find(x => x.Key == "Value").Value.ToString();
                    var result = StampDutyCalculatorHelper.CalculateNonResidentialProperty(Convert.ToDouble(value));
                    StampDutyHelper.PrintTax(result);
                }
                Console.WriteLine("Another Property...");
            }
        }
예제 #3
0
        public static void Start()
        {
            while (true)
            {
                var price = 0.0;
                Console.WriteLine("Freehold or LeaseHold");
                Console.WriteLine("1. Freehold");
                Console.WriteLine("2. Leasehold");
                var isFreehold = Console.ReadLine();

                if (isFreehold == "1")
                #region FreeHold
                {
                    Console.WriteLine("Residential or Non-residential");
                    Console.WriteLine("1. Residential");
                    Console.WriteLine("2. Non-residential");
                    var isResidential = Console.ReadLine();

                    if (isResidential == "1")
                    {
                        #region Residential
                        Console.WriteLine("Transaction Date");
                        Console.WriteLine("1. After 01/04/2016");
                        Console.WriteLine("2. Before 01/04/2016");
                        var transactionDate = Console.ReadLine();

                        if (transactionDate == "1")
                        {
                            #region After2016
                            Console.WriteLine("Individual or Joined");
                            Console.WriteLine("1. Individual");
                            Console.WriteLine("2. Joined");
                            var isIndividual = Console.ReadLine();

                            if (isIndividual == "1")
                            {
                                #region Individual
                                Console.WriteLine("Second Home");
                                Console.WriteLine("1. Yes");
                                Console.WriteLine("2. No");
                                var isSecond = Console.ReadLine();

                                if (isSecond == "1")
                                {
                                    #region SecondHome
                                    Console.WriteLine("Replacing main property");
                                    Console.WriteLine("1. Yes");
                                    Console.WriteLine("2. No");
                                    var isReplacing = Console.ReadLine();

                                    if (isReplacing == "1")
                                    {
                                        #region replacingmainhome
                                        Console.WriteLine("Property Price:");
                                        price = Convert.ToDouble(Console.ReadLine());
                                        Console.WriteLine($"Price: {price}");
                                        Console.WriteLine($"Replacing main property: {isReplacing}");
                                        Console.WriteLine($"Second Home: {isSecond}");
                                        Console.WriteLine($"Individual: {isIndividual}");
                                        Console.WriteLine($"TransactionDate: {transactionDate}");
                                        Console.WriteLine($"Residential: {isResidential}");
                                        Console.WriteLine($"Freehold: {isFreehold}");

                                        var result = StampDutyCalculatorHelper.CalculateResidentialSecondHome(price);
                                        StampDutyHelper.PrintTax(result);
                                        #endregion
                                    }
                                    else
                                    {
                                        #region keepasSecond
                                        Console.WriteLine("Property Price:");
                                        price = Convert.ToDouble(Console.ReadLine());
                                        Console.WriteLine($"Price: {price}");
                                        Console.WriteLine($"Replacing main property: {isReplacing}");
                                        Console.WriteLine($"Second Home: {isSecond}");
                                        Console.WriteLine($"Individual: {isIndividual}");
                                        Console.WriteLine($"TransactionDate: {transactionDate}");
                                        Console.WriteLine($"Residential: {isResidential}");
                                        Console.WriteLine($"Freehold: {isFreehold}");

                                        var result = StampDutyCalculatorHelper.CalculateResidentialSecondHome(price);
                                        StampDutyHelper.PrintTax(result);
                                        #endregion
                                    }
                                    #endregion
                                }
                                else
                                {
                                    #region FirstTimeBuyer
                                    Console.WriteLine("Property Price:");
                                    price = Convert.ToDouble(Console.ReadLine());
                                    Console.WriteLine($"Price: {price}");
                                    Console.WriteLine($"Second Home: {isSecond}");
                                    Console.WriteLine($"Individual: {isIndividual}");
                                    Console.WriteLine($"TransactionDate: {transactionDate}");
                                    Console.WriteLine($"Residential: {isResidential}");
                                    Console.WriteLine($"Freehold: {isFreehold}");

                                    var result = StampDutyCalculatorHelper.CalculateResidentialHome(price);
                                    StampDutyHelper.PrintTax(result);

                                    #endregion
                                }
                                #endregion
                            }
                            else
                            {
                                #region organisation
                                Console.WriteLine("Property Price:");
                                price = Convert.ToDouble(Console.ReadLine());
                                Console.WriteLine($"Price: {price}");
                                Console.WriteLine($"Individual: {isIndividual}");
                                Console.WriteLine($"TransactionDate: {transactionDate}");
                                Console.WriteLine($"Residential: {isResidential}");
                                Console.WriteLine($"Freehold: {isFreehold}");

                                var result = StampDutyCalculatorHelper.CalculateResidentialHome(price);
                                StampDutyHelper.PrintTax(result);
                                #endregion
                            }
                            #endregion
                        }
                        else
                        {
                            #region Before2016
                            Console.WriteLine("Property Price:");
                            price = Convert.ToDouble(Console.ReadLine());
                            Console.WriteLine($"Price: {price}");
                            Console.WriteLine($"TransactionDate: {transactionDate}");
                            Console.WriteLine($"Residential: {isResidential}");
                            Console.WriteLine($"Freehold: {isFreehold}");

                            var result = StampDutyCalculatorHelper.CalculateResidentialHome(price);
                            StampDutyHelper.PrintTax(result);
                            #endregion
                        }
                        #endregion
                    }
                    else
                    {
                        #region Non-Residential
                        Console.WriteLine("Property Price:");
                        price = Convert.ToDouble(Console.ReadLine());
                        Console.WriteLine($"Price: {price}");
                        Console.WriteLine($"Residential: {isResidential}");
                        Console.WriteLine($"Freehold: {isFreehold}");

                        var result = StampDutyCalculatorHelper.CalculateNonResidentialProperty(price);
                        StampDutyHelper.PrintTax(result);
                        #endregion
                    }
                    #endregion
                }
                else
                {
                    #region Leasehold
                    Console.WriteLine("Residential or Non-residential");
                    Console.WriteLine("1. Residential");
                    Console.WriteLine("2. Non-residential");
                    var isResidential = Console.ReadLine();

                    if (isResidential == "1")
                    {
                        #region Residential
                        Console.WriteLine("Transaction Date");
                        Console.WriteLine("1. After 01/04/2016");
                        Console.WriteLine("2. Before 01/04/2016");
                        var transactionDate = Console.ReadLine();

                        if (transactionDate == "1")
                        {
                            #region After2016
                            Console.WriteLine("Individual or Joined");
                            Console.WriteLine("1. Individual");
                            Console.WriteLine("2. Joined");
                            var isIndividual = Console.ReadLine();

                            if (isIndividual == "1")
                            {
                                #region Individual
                                Console.WriteLine("Second Home");
                                Console.WriteLine("1. Yes");
                                Console.WriteLine("2. No");
                                var isSecond = Console.ReadLine();

                                if (isSecond == "1")
                                {
                                    #region SecondHome
                                    Console.WriteLine("Replacing main property");
                                    Console.WriteLine("1. Yes");
                                    Console.WriteLine("2. No");
                                    var isReplacing = Console.ReadLine();

                                    if (isReplacing == "1")
                                    {
                                        #region replacingmainhome
                                        Console.WriteLine("Property Price:");
                                        price = Convert.ToDouble(Console.ReadLine());
                                        Console.WriteLine($"Price: {price}");
                                        Console.WriteLine($"Replacing main property: {isReplacing}");
                                        Console.WriteLine($"Second Home: {isSecond}");
                                        Console.WriteLine($"Individual: {isIndividual}");
                                        Console.WriteLine($"TransactionDate: {transactionDate}");
                                        Console.WriteLine($"Residential: {isResidential}");
                                        Console.WriteLine($"Freehold: {isFreehold}");
                                        #endregion
                                    }
                                    else
                                    {
                                        #region keepasSecond
                                        Console.WriteLine("Property Price:");
                                        price = Convert.ToDouble(Console.ReadLine());
                                        Console.WriteLine($"Price: {price}");
                                        Console.WriteLine($"Replacing main property: {isReplacing}");
                                        Console.WriteLine($"Second Home: {isSecond}");
                                        Console.WriteLine($"Individual: {isIndividual}");
                                        Console.WriteLine($"TransactionDate: {transactionDate}");
                                        Console.WriteLine($"Residential: {isResidential}");
                                        Console.WriteLine($"Freehold: {isFreehold}");
                                        #endregion
                                    }
                                    #endregion
                                }
                                else
                                {
                                    #region FirstTimeBuyer
                                    Console.WriteLine("Property Price:");
                                    price = Convert.ToDouble(Console.ReadLine());
                                    Console.WriteLine($"Price: {price}");
                                    Console.WriteLine($"Second Home: {isSecond}");
                                    Console.WriteLine($"Individual: {isIndividual}");
                                    Console.WriteLine($"TransactionDate: {transactionDate}");
                                    Console.WriteLine($"Residential: {isResidential}");
                                    Console.WriteLine($"Freehold: {isFreehold}");
                                    #endregion
                                }
                                #endregion
                            }
                            else
                            {
                                #region organisation
                                Console.WriteLine("Property Price:");
                                price = Convert.ToDouble(Console.ReadLine());
                                Console.WriteLine($"Price: {price}");
                                Console.WriteLine($"Individual: {isIndividual}");
                                Console.WriteLine($"TransactionDate: {transactionDate}");
                                Console.WriteLine($"Residential: {isResidential}");
                                Console.WriteLine($"Freehold: {isFreehold}");
                                #endregion
                            }
                            #endregion
                        }
                        else
                        {
                            #region Before2016
                            Console.WriteLine("Property Price:");
                            price = Convert.ToDouble(Console.ReadLine());
                            Console.WriteLine($"Price: {price}");
                            Console.WriteLine($"TransactionDate: {transactionDate}");
                            Console.WriteLine($"Residential: {isResidential}");
                            Console.WriteLine($"Freehold: {isFreehold}");
                            #endregion
                        }
                        #endregion
                    }
                    else
                    {
                        #region Non-Residential
                        Console.WriteLine("Property Price:");
                        price = Convert.ToDouble(Console.ReadLine());
                        Console.WriteLine($"Price: {price}");
                        Console.WriteLine($"Residential: {isResidential}");
                        Console.WriteLine($"Freehold: {isFreehold}");
                        #endregion
                    }
                    #endregion
                }
                Console.ReadLine();
            }
        }