第2章:财务应用程序:计算未来投资值 【对话框】
2012-12-24 17:05
344 查看
/** * 财务应用程序:计算未来投资值。 * 读取投资总额、年利率和年数: * 使用下面公式显示未来投资金额: * futureInvestmentValue = investmentAmount * Math.pow((1 + annuallyInterestRate, numberOfYears*12)。 * 例如输入的投资金额为1000,年利率为3.25%,年数为1,那么未来投资额为1032.98。 * 下面是一个运行示例: * ———————————————————————————————————————————— * | Enter investment amount: 1000 | * | Enter monthly interest rate: 0.0425 | * | Enter number of years: 1 | * | Accumulated value is 1647.8313602236476 | * ———————————————————————————————————————————— */ package Test; import javax.swing.JOptionPane; public class T213InputDialog { public static void main(String[] args) { String investmentAmountString = JOptionPane.showInputDialog("Enter investment amount: "); double investmentAmount = Double.parseDouble(investmentAmountString); String annuallyInterestRateString = JOptionPane.showInputDialog("Enter monthly interest rate: "); double annuallyInterestRate = Double.parseDouble(annuallyInterestRateString); String numberOfYearsString = JOptionPane.showInputDialog("Enter number of years: "); double numberOfYears = Double.parseDouble(numberOfYearsString); double futureInvestmentValue = investmentAmount * Math.pow((1 + annuallyInterestRate), numberOfYears * 12); String ouput = "Accumulated value is " + futureInvestmentValue; JOptionPane.showMessageDialog(null, ouput); } }
相关文章推荐
- 第2章:财务应用程序:计算未来投资值 【控制台输出】
- 第2章:财务应用程序:计算利息 【对话框输出】
- acmore|acmore.cc1017财务应用程序: 计算利息1018财务应用程序:计算未来投资值1019医疗应用程序: 计算BMI1020财务应用程序:复利值
- 第2章:财务应用程序:计算利息 【控制台输出】
- 第2章:财务应用程序:计算小费
- 第2章:财务应用程序:工资单
- 第2章:医疗应用程序:计算BMI
- 第2章:财务应用程序:复利值
- acmore|acmore.cc1011将磅转换为千克1012财务应用程序:计算消费1013求一个整数各位数的和1014求出年数1015求ASCII码对应的字符
- Dynamics AX中财务相关的函数(1)——ddb——双倍余额递减法计算固定资产折旧
- 使用 jQuery,第 2 部分: 构建未来的 Web 应用程序
- Dynamics AX中财务相关的函数(3)——syd——年数总和法计算固定资产折旧
- 把时间投资在自己的未来
- 《系统分析与设计方法》 计算投资回收分析
- CSR推出超薄无线触摸屏,引领计算界面的未来发展
- CLR via C# 3 读书笔记(15):第2章 生成、打包、部署和管理应用程序与类型 — 2.6 语言文化 & 2.7 简单应用程序部署
- 云服务三大部署模式-私有云、公有云、混合云谁才是云计算未来的主流
- Excel 服务:为您的应用程序开发计算引擎
- 【Java】编写一个小应用程序计算输入数字的和、平均值
- 基于对话框的应用程序添加启动画面