filled in calculateTotalSavingsFactor()

git-svn-id: svn://anubis/gvsu@444 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
josh 2009-10-05 02:01:47 +00:00
parent 39ee5aad11
commit 9b5a16a6b9

View File

@ -94,4 +94,22 @@ public class RetirementCalculatorModel
{
return 0.0;
}
private double calculateTotalSavingsFactor()
{
double retire_age = getField("retirement age");
double current_age = getField("age");
double years_to_retirement = retire_age - current_age;
int five_years_to_retirement =
(int) ((years_to_retirement + 2.5) / 5.0);
if (five_years_to_retirement < 2)
five_years_to_retirement = 2;
if (five_years_to_retirement > 8)
five_years_to_retirement = 8;
int total_savings_factor_index = five_years_to_retirement - 2;
double total_savings_factors[] = {
0.085, 0.052, 0.036, 0.027, 0.020, 0.016, 0.013
};
return total_savings_factors[total_savings_factor_index];
}
}