Exemple #1
0
        /// <summary>
        /// Produces the item names to rates for the Judgement Deductions (e.g. alimony paid-out)
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        protected internal Dictionary <string, double> GetJudgmentDeductionName2RandomRates(AmericanDomusOpesOptions options)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();
            const string CHILD_SUPPORT = "Child Support";
            const string ALIMONY       = "Alimony";

            var pay = GetPay(options);

            if (options.IsPayingChildSupport &&
                !options.AnyGivenDirectlyOfNameAndGroup(CHILD_SUPPORT, DeductionGroupNames.JUDGMENTS))
            {
                var adjPay               = AmericanEquations.GetInflationAdjustedAmount(pay, 2015, options.Inception);
                var adjMonthlyPay        = adjPay / 12;
                var childSupportEquation =
                    AmericanEquations.GetChildSupportMonthlyCostEquation(options.GetChildrenAges().Count);
                var childSupport = Math.Round(childSupportEquation.SolveForY(adjMonthlyPay), 2);

                //need to turn this back into annual amount
                childSupport = childSupport * 12;
                options.AddGivenDirectly(CHILD_SUPPORT, DeductionGroupNames.JUDGMENTS, childSupport);
            }

            if (options.IsPayingSpousalSupport &&
                !options.AnyGivenDirectlyOfNameAndGroup(ALIMONY, DeductionGroupNames.JUDGMENTS))
            {
                //this is technically computed as 0.25 * (diff in spousal income)
                var randRate      = Etx.RandomDouble(0.01, 0.25);
                var spouseSupport = Math.Round(randRate * pay, 2);
                options.AddGivenDirectly(ALIMONY, DeductionGroupNames.JUDGMENTS, spouseSupport);
            }

            var d = GetItemNames2Portions(DeductionGroupNames.JUDGMENTS, options);

            return(d.ToDictionary(t => t.Item1, t => t.Item2));
        }
Exemple #2
0
 public void TestGetChildSupportMonthlyCostEquation()
 {
     for (var i = 1; i <= 5; i++)
     {
         var prev = 0.0D;
         for (var j = 2000; j < 55000; j += 500)
         {
             var t       = AmericanEquations.GetChildSupportMonthlyCostEquation(i);
             var current = t.SolveForY(j);
             //assert it never goes down as income goes up
             if (current < prev)
             {
                 Console.WriteLine($"i {i}, j {j}, current {current}, prev {prev}");
             }
             Assert.IsTrue(current >= prev);
             prev = current;
         }
     }
 }
Exemple #3
0
        /// <summary>
        /// Determines if the annual gross income is at or below the federal poverty level.
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        protected internal virtual bool IsBelowFedPovertyAt(AmericanDomusOpesOptions options)
        {
            options = options ?? AmericanDomusOpesOptions.RandomOpesOptions();
            var dt = options.Inception;
            var numHouseholdMembers =
                1 + (options.FactorOptions.MaritalStatus == MaritalStatus.Married ? 1 : 0) + options.ChildrenDobs?.Count ?? 0;

            numHouseholdMembers = numHouseholdMembers <= 0 ? 1 : numHouseholdMembers;
            var povertyLevel = AmericanEquations.GetFederalPovertyLevel(dt);

            var payAtDt = GetEmploymentAt(dt);

            if (payAtDt == null || !payAtDt.Any())
            {
                return(false);
            }

            numHouseholdMembers = numHouseholdMembers <= 0 ? 1 : numHouseholdMembers;

            return(GetAnnualEmplyGrossIncome(dt).ToDouble() <= povertyLevel.SolveForY(numHouseholdMembers));
        }