Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 83033

Submitted on 27 Apr 2012 by Ben Petschel

Correct

70Size
Leading solution size is 36.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
financial.startingSalary =   50000;
financial.investRate     =       0.1;
financial.returnRate     =       0.1;
financial.raiseRate      =       0.05;
financial.goal           = 1000000;
y_correct = 29;
assert(isequal(calculateRetirementYear(financial),y_correct))
val =
        5000
val =
       10750
val =
   1.7338e+04
val =
   2.4859e+04
val =
   3.3423e+04
val =
   4.3147e+04
val =
   5.4162e+04
val =
   6.6613e+04
val =
   8.0662e+04
val =
   9.6485e+04
val =
   1.1428e+05
val =
   1.3426e+05
val =
   1.5666e+05
val =
   1.8176e+05
val =
   2.0983e+05
val =
   2.4121e+05
val =
   2.7625e+05
val =
   3.1533e+05
val =
   3.5890e+05
val =
   4.0742e+05
val =
   4.6143e+05
val =
   5.2150e+05
val =
   5.8828e+05
val =
   6.6246e+05
val =
   7.4484e+05
val =
   8.3625e+05
val =
   9.3765e+05
val =
   1.0501e+06
2
Pass
 
%%
financial.startingSalary =   60000;
financial.investRate     =       0.12;
financial.returnRate     =       0.1;
financial.raiseRate      =       0.05;
financial.goal           = 1000000;
y_correct = 26;
assert(isequal(calculateRetirementYear(financial),y_correct))
val =
        7200
val =
       15480
val =
       24966
val =
   3.5798e+04
val =
   4.8129e+04
val =
   6.2131e+04
val =
   7.7993e+04
val =
   9.5923e+04
val =
   1.1615e+05
val =
   1.3894e+05
val =
   1.6456e+05
val =
   1.9333e+05
val =
   2.2559e+05
val =
   2.6173e+05
val =
   3.0216e+05
val =
   3.4734e+05
val =
   3.9779e+05
val =
   4.5407e+05
val =
   5.1681e+05
val =
   5.8669e+05
val =
   6.6446e+05
val =
   7.5096e+05
val =
   8.4712e+05
val =
   9.5395e+05
val =
   1.0726e+06
3
Pass
 
%%
financial.startingSalary =   60000;
financial.investRate     =       0.12;
financial.returnRate     =       0.1;
financial.raiseRate      =       0.05;
financial.goal           = 2000000;
y_correct = 32;
assert(isequal(calculateRetirementYear(financial),y_correct))
val =
        7200
val =
       15480
val =
       24966
val =
   3.5798e+04
val =
   4.8129e+04
val =
   6.2131e+04
val =
   7.7993e+04
val =
   9.5923e+04
val =
   1.1615e+05
val =
   1.3894e+05
val =
   1.6456e+05
val =
   1.9333e+05
val =
   2.2559e+05
val =
   2.6173e+05
val =
   3.0216e+05
val =
   3.4734e+05
val =
   3.9779e+05
val =
   4.5407e+05
val =
   5.1681e+05
val =
   5.8669e+05
val =
   6.6446e+05
val =
   7.5096e+05
val =
   8.4712e+05
val =
   9.5395e+05
val =
   1.0726e+06
val =
   1.2042e+06
val =
   1.3502e+06
val =
   1.5121e+06
val =
   1.6916e+06
val =
   1.8904e+06
val =
   2.1105e+06
4
Pass
 
%%
financial.startingSalary =   60000;
financial.investRate     =       0.12;
financial.returnRate     =       0.1;
financial.raiseRate      =       0.08;
financial.goal           = 2000000;
y_correct = 29;
assert(isequal(calculateRetirementYear(financial),y_correct))
val =
        7200
val =
   1.5696e+04
val =
   2.5664e+04
val =
   3.7300e+04
val =
   5.0825e+04
val =
   6.6487e+04
val =
   8.4561e+04
val =
   1.0536e+05
val =
   1.2922e+05
val =
   1.5653e+05
val =
   1.8773e+05
val =
   2.2329e+05
val =
   2.6375e+05
val =
   3.0971e+05
val =
   3.6183e+05
val =
   4.2085e+05
val =
   4.8760e+05
val =
   5.6300e+05
val =
   6.4807e+05
val =
   7.4396e+05
val =
   8.5191e+05
val =
   9.7334e+05
val =
   1.1098e+06
val =
   1.2631e+06
val =
   1.4350e+06
val =
   1.6279e+06
val =
   1.8439e+06
val =
   2.0858e+06