A bank offers the following mortgage rates:
Term Rate
10 years 3.00%
30 years 4.50%
With the following modifiers based on a customer's credit score:
Credit Score Rate Modifier
300 to 699 2.00%
700 to 799 0.00%
800 to 850 -0.50%
The actual rate for a mortgage is calculated using both the term and the credit score. For example if a person needs a 10 year mortgage and has a credit score of 550 the rate would be: 3% + 2% = 5%. If another person needs the same mortgage but has a credit score of 810, the rate would be 3% - 0.50% = 2.50%.
float calculaterate(int term, int score)
{
float rate = 0;
if (term == 10)
rate = 0.03f;
else if (term == 30)
rate = 0.045f;
if (score >= 800)
return rate - 0.005f;
else if (score >= 700)
return rate;
else if (score >= 300)
return rate + 0.02f;
throw new ArgumentOutOfRangeException();
}
The number of test cases needed to achieve 100% code coverage is
What I have tried:
I rate: 10, score: 300, result:
0.05
rate: 10, score: 700, result:
0.03
rate: 10, score: 850, result:
0.025
rate: 30, score: 300, result:
0.065
rate: 30, score: 700, result:
0.045
rate: 30, score: 850, result: