测试模块 | 输入测试 | 预期结果 | 运行结果 |
复/单利计算本息 | (本金,年利率,年限) | ||
1000,0.03,10 |
复利:1343.92 单利:1300.0 |
√ | |
0,0.03,10 |
复利:0.0 单利:0.0 |
√ | |
1000,0,10 |
复利:1000.0 单利:1000.0 |
√ | |
1000,0.03,10 |
复利:1000.0 单利:1000.0 |
√ | |
复/单利计算本金 | (本息,年利率,年限) | ||
1000,0.03,10 |
复利:744.09 单利:769.23
|
√ | |
0,0.03,10 |
复利:0.0 单利:0.0 |
√ | |
1000,0,10 |
复利:1000.0 单利:1000.0 |
√ | |
1000,0.03,0 |
复利:1000.0 单利:1000.0 |
√ | |
算投资年限 | (投资金额,收获金额,年利率) | ||
1000,2000,0.03 | 24.0 | √ | |
0,2000,0.03 | 除数不能为0 | √ | |
1000,0,0.03 | -Infinity | √ | |
1000,2000,0 | Infinity | √ | |
算投资年利率 | (投资金额,收获金额,年限) | ||
1000,2000,10 | 0.0718 | √ | |
0,2000,10 | 除数不能为0 | 乱码 | |
1000,0,10 | -1.0 | √ | |
1000,2000,0 | 除数不能为0 | 乱码 | |
每年/月定投收益 | (投资金额,年利率,年限) | ||
1000,0.03,10 |
每年:11807.8 每月:140090.77 |
√ | |
0,0.03,10 |
每年:0.0 每月:0.0 |
√ | |
1000,0,10 |
每年: 除数不能为0 每月: 除数不能为0 |
√ | |
1000,0.03,0 |
每年:0.0 每月:0.0 |
√ | |
每月等额本息还款 | (贷款本金,年利率,年限) | ||
100000,0.03,10 | 965.61 | √ | |
0,0.03,10 | 0.0 | √ | |
100000,0,10 | 0.0 | √ | |
100000,0.03,0 | 乱码 |
允许误差:
不允许误差:
原文:http://www.cnblogs.com/xjy-gg/p/5338928.html