/**
  * Calculates Discretionary Net Worth contribution
  * @param EfcCalculationRole $role Subject's role within the calculation
  * @param MaritalStatus $maritalStatus Marital status
  * @param int $age Age
  * @param float $cashSavingsCheckings Cash, savings, and checkings value
  * @param float $investmentNetWorth Net worth of investments
  * @param float $businessFarmNetWorth Net worth of business and/or investment farm
  * @return float
  */
 public function calculateDiscretionaryNetWorth($role, $maritalStatus, $age, $cashSavingsCheckings, $investmentNetWorth, $businessFarmNetWorth)
 {
     $discretionaryNetWorth = 0;
     $discretionaryNetWorth += $this->calculateNetWorth($role, $cashSavingsCheckings, $investmentNetWorth, $businessFarmNetWorth);
     $discretionaryNetWorth -= $this->calculateAssetProtectionAllowance($maritalStatus, $age);
     return EfcMathHelper::round($discretionaryNetWorth);
 }
 /**
  * Calculates Available Income
  * @param EfcCalculationRole $role Subject's role within the calculation
  * @param float $totalIncome Total income
  * @param float $totalAllowances Total allowances
  * @return float
  */
 public function calculateAvailableIncome($role, $totalIncome, $totalAllowances)
 {
     $availableIncome = EfcMathHelper::round($totalIncome - $totalAllowances);
     // The available income for Dependent Students and Independent Students Without Depends is
     // multiplied by an assessment percent
     if ($role == EfcCalculationRole::DependentStudent || $role == EfcCalculationRole::IndependentStudentWithoutDependents) {
         return $availableIncome < 0 ? 0 : EfcMathHelper::round($availableIncome * $this->_constants->aiAssessmentPercent);
     }
     return $availableIncome;
 }
 /**
  * Calculates student contribution (SC) and expected family contribution (EFC) for an independent student
  * @param IndependentEfcCalculatorArguments $args Parameters for the calculation
  * @return EfcProfile
  */
 public function getIndependentEfcProfile($args)
 {
     if ($args->numberInCollege <= 0 || $args->monthsOfEnrollment <= 0 || $args->student == null) {
         return new EfcProfile(0, 0, 0, 0);
     }
     $role = $args->hasDependents ? EfcCalculationRole::IndependentStudentWithDependents : EfcCalculationRole::IndependentStudentWithoutDependents;
     $workIncome = 0;
     $householdMembers = array($args->student);
     $workIncome += $args->student->isWorking ? $args->student->workIncome : 0;
     if ($args->spouse != null) {
         if ($args->spouse->isWorking) {
             $workIncome += $args->spouse->workIncome;
         }
         $householdMembers[] = $args->spouse;
     }
     $simpleIncome = $args->areTaxFilers ? $args->adjustedGrossIncome : $workIncome;
     // Determine Auto Zero EFC eligibility
     if ($args->isQualifiedForSimplified && $role == EfcCalculationRole::IndependentStudentWithDependents && $simpleIncome <= $this->_constants->autoZeroEfcMax) {
         return new EfcProfile(0, 0, 0, 0);
     }
     // Student's Total Income
     $totalIncome = $this->_incomeCalculator->calculateTotalIncome($args->adjustedGrossIncome, $workIncome, $args->areTaxFilers, $args->untaxedIncomeAndBenefits, $args->additionalFinancialInfo);
     // Student's Total Allowances
     $totalAllowances = $this->_allowanceCalculator->calculateTotalAllowances($role, $args->maritalStatus, $args->stateOfResidency, $args->numberInCollege, $args->numberInHousehold, $householdMembers, $totalIncome, $args->incomeTaxPaid);
     // Student's Available Income (Contribution from Available Income)
     $availableIncome = $this->_incomeCalculator->calculateAvailableIncome($role, $totalIncome, $totalAllowances);
     // Determine Simplified EFC Equation Eligibility
     $useSimplified = $args->isQualifiedForSimplified && $simpleIncome <= $this->_constants->simplifiedEfcMax;
     // Student's Contribution From Assets
     $assetContribution = 0;
     if (!$useSimplified) {
         $assetContribution = $this->_assetContributionCalculator->calculateContributionFromAssets($role, $args->maritalStatus, $args->age, $args->cashSavingsCheckings, $args->investmentNetWorth, $args->businessFarmNetWorth);
     }
     // Student's Adjusted Available Income
     $adjustedAvailableIncome = $availableIncome + $assetContribution;
     // Student Contribution From AAI
     $studentContributionFromAai = $this->_aaiContributionCalculator->calculateContributionFromAai($role, $adjustedAvailableIncome);
     // Student's Contribution
     $studentContribution = EfcMathHelper::round($studentContributionFromAai / $args->numberInCollege);
     // Modify Student's Available Income based on months of enrollment
     if ($args->monthsOfEnrollment < self::DefaultMonthsOfEnrollment) {
         // LESS than default months of enrollment
         $monthlyContribution = EfcMathHelper::round($studentContribution / self::DefaultMonthsOfEnrollment);
         $studentContribution = $monthlyContribution * $args->monthsOfEnrollment;
     }
     // For MORE than default months of enrollment, the standard contribution is used
     $profile = new EfcProfile($studentContribution, 0, $studentContribution, 0);
     return $profile;
 }