Test Informed Learning with Examples

Logo

Repository with assignments using the Test Informed Learning with Examples (TILE) method to integrate testing into existing programming courses for free.

Menu

LinkedIN Community

Join our LinkedIN Community.

Interest calculator

Implement a program that calculates the interest produced from a total accumulated capital of an amount c, invested at an interest r (as a percentage) during t days. The formula used to calculate interest is:

\[I=\frac{c \times r \times t}{360 \times 100}\]

To test your program you can try with the following test cases:

test case ID inputs     expected output
\(c\) \(r\) \(t\)    
1 10000 5.5% 360 550 euros
2 25000 60% 45 1875 euros
3 0 50% 200 0.0
4 -2000 45% 2 -5.0
5 12.345 56.78% 900 17.0
Instead of sample executions for them to check, we add a table with
test cases. This teaches them what test cases are made up of:

-   identifier

-   inputs

-   expected outputs