算法笔记_114:等额本金(Java)
2024-08-25 05:03:57
1 等额本金
标题:等额本金 小明从银行贷款3万元。约定分24个月,以等额本金方式还款。 这种还款方式就是把贷款额度等分到24个月。每个月除了要还固定的本金外,还要还贷款余额在一个月 中产生的利息。 假设月利率是:0.005,即:千分之五。那么, 第一个月,小明要还本金 1250, 还要还利息:30000 * 0.005,总计 1400
第二个月,本金仍然要还 1250, 但利息为:(30000-1250) * 0.005 总计 1393.75 请问:小明在第15个月,应该还款多少(本金和利息的总和)? 请把答案金额四舍五入后,保留两位小数。注意:32.5,一定要写为:32.50 通过浏览器提交答案,这是一个含有小数点和两位小数的浮点数字。不要写多余内容(例如:多写了“元 ”或添加说明文字) 1312.50
public class Main { public void printResult() {
double money = 30000;
for(int i = 1;i <= 14;i++) {
money = money * (1 + 0.005) - 1250 - money * 0.005;
}
double result = 1250 + money * 0.005;
System.out.println(result);
return;
} public static void main(String[] args) {
Main test = new Main();
test.printResult();
} }
最新文章
- JS常用各种正则表达式
- poj 3083 Children of the Candy Corn(DFS+BFS)
- mono 判断系统的网络是否可用
- 8年,属于 HTML 5 春天的到来悄悄!
- Swift中自定义打印方法
- 谈JS中的作用域链与原型链(1)
- Learning ROS for Robotics Programming Second Edition学习笔记(九) indigo Gazebo rviz slam navigation
- LwIP Application Developers Manual2---Protocols概览
- web 前端知识体系 网站资源分析
- 字符常量 java
- ubuntu16.04 彻底卸载MySQL
- set<;pair<;int,int>; >;的用法
- Linux 搭建FTP
- Codeforces Good Bye 2018
- 以整数元素构成的list中的数字组成最小整数
- tomcat部署jenkins启动报错:insufficient free space available after evicting expired cache entries-consider increasing the maximum size of the cache.
- Word中调整编号和文字的间距
- 引进js文件运行在浏览器上调试报文件找不到
- luogu 1355 神秘大三角 判断点和三角形的位置关系 面积法 叉积法
- Log4J的配置与使用详解