import javax.swing.JOptionPane;
public class ComputeLoanUsingInputDialog {
public static void main(String[] args) {
String annualInterestRateString = JOptionPane.showInputDialog(
"Enter yearly interest rate, for example 8.25:"); double annualInterestRate =
Double.parseDouble(annualInterestRateString);
double monthlyInteresRate = annualInterestRate / ;
String numberOfYearsString = JOptionPane.showInputDialog(
"Enter number of years as an integer, \nfor example 5:"); int numberOfYears = Integer.parseInt(numberOfYearsString);
String loanString = JOptionPane.showInputDialog(
"Enter loan amount, for example 120000.95:"); double loanAmount = Double.parseDouble(loanString); double monthlyPayment = loanAmount * monthlyInteresRate / (
- / Math.pow( + monthlyInteresRate, numberOfYears * ));
double totalPayment = monthlyPayment * numberOfYears * ; monthlyPayment = (int)(monthlyPayment * ) / 100.0;
totalPayment = (int)(totalPayment * ) / 100.0; String output = "the monthly payment is " + monthlyPayment +
"\nthe total payment is " + totalPayment;
JOptionPane.showMessageDialog(null, output); }
}

最新文章

  1. jQuery MiniUI开发系列之:使用API文档
  2. Asp.Net MVC4入门指南(6):验证编辑方法和编辑视图
  3. css3易混淆属性详解
  4. MyEclipse从数据库反向生成实体类之Hibernate方式 反向工程
  5. Jsp页显示时间标签JSTL标签 <fmt:formatDate/> 实例大全
  6. git流程及操作
  7. phalcon:非空字段不能在beforeCreate赋值,可以改用beforeValidationOnCreate
  8. 从cpu加电到加载OS内核的详细过程(清华大学ucore-lab1总结一)
  9. ASP.NET页面同时发起多个ajax请求,出现阻塞情况
  10. ORA-01034/ORA-27101解决
  11. 淘特房产CMS系统 7.5
  12. html5 画个圈
  13. OpenCv的Java,C++开发环境配置
  14. mysql 日期 字符串
  15. 强大的css3库
  16. SVG之颜色、渐变和笔刷的使用
  17. Typora开启行内公式
  18. oracle数据库连接 ORA-12638:身份证明检索失败
  19. 关于JAVA文件的字节转字符练习
  20. c#运用反射获取属性和设置属性值

热门文章

  1. Cobaltstrike系列教程(二)-Listner与Payload生成 heatlevel
  2. Anacond的介绍
  3. 在linux中 部署 mongo 数据库服务端
  4. 【Swagger2】SpringBoot整合swagger2
  5. File upload with cropping support using Cropper --jquery file upload
  6. MATLAB 用 imresize() 函数缩小图象是 double 和 uint8 有差别
  7. day15—jQuery UI之widgets插件
  8. CentOS7.X安装FastDFS-5.10
  9. delphi 手势 识别 哈哈
  10. Vagrant 入门 - 同步目录(synced folders)