java textpad_【帮忙用textpad写一串JAVA编码,程序要求在下方。答的好的加50分1.Writeaprogramthatreadsininvestmentamount,annuali...

import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

/*

* 2.9 (Calculatingthe future investment value) Write a program that reads ininvestment amount,

* annual interestrate, and number of years, and display the future investment valueusing the

* followingformula:

futureInvestmentValue =

investmentAmount x(1 + monthlyInterestRate)numberofYears*12

For example, if youentered amount 1000, annual interest rate 3.25%, and number ofyears 1, the future investment value is 1032.98.

Hint:

Use the Math.pow (a,b) method to compute a raised to the power of b.

*/

public class InvestmenntValue{

public static void main(String[] args)throwsIOException {

double investmentAmount =0.0;

double yearlyInterestRate =0.0;

double monthlyInterest =0.0;

int years = 0;

double futureInvestmentValue =0.0;

double temp = 0.0;

BufferedReader my_Buffer;

my_Buffer =newBufferedReader(new InputStreamReader(System.in));

System.out.println("Enter investment amount:" );

investmentAmount =Double.parseDouble(my_Buffer.readLine());

System.out.println("Enter annualinterest rate : " );

yearlyInterestRate =Double.parseDouble(my_Buffer.readLine());

System.out.println("Enter years: ");

years =Integer.parseInt(my_Buffer.readLine());

yearlyInterestRate /=100.0;

monthlyInterest = yearlyInterestRate/ 12.0;

years *= 12;

temp = investmentAmount * (1 +monthlyInterest);

futureInvestmentValue =Math.pow(temp, years);

System.out.println("Answer = "+String.valueOf(futureInvestmentValue));

}

}

作业帮用户

2017-05-02

举报

6c0a0adef10d1043fa4f41a7897345ed.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值