早教吧作业答案频道 -->其他-->
帮忙用textpad写一串JAVA编码,程序要求在下方。答的好的加50分1.Writeaprogramthatreadsininvestmentamount,annualinterestrate,andnumberofyears,anddisplaysthefutureinvestmentvalueusingthefollowingformula:futur
题目详情
帮忙用textpad写一串JAVA编码,程序要求在下方。答的好的加50分
1. Write a program that reads in investment amount, annual interest rate, and number
of years, and displays the future investment value using the following formula:
futureInvestmentValue = investmentAmount(1+monthlyInterestRate)numberOfYears*12
Hint: Use the Math.pow(a, b) method to compute a raised to the power of b.
1. Write a program that reads in investment amount, annual interest rate, and number
of years, and displays the future investment value using the following formula:
futureInvestmentValue = investmentAmount(1+monthlyInterestRate)numberOfYears*12
Hint: Use the Math.pow(a, b) method to compute a raised to the power of b.
▼优质解答
答案和解析
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));
}
}
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));
}
}
看了 帮忙用textpad写一串J...的网友还看了以下:
求冲量、动量和动能、合外力对质点所做的功一质量m=2kg的质点在合外力F=2ti+tj(SI)作用下 2020-03-30 …
以下几个方程是整式方程吗?(1).(x^2/2)-x-√3=0(2).√t^2-√2t=-2t^2 2020-05-24 …
关于常微分方程的一个问题王高雄版的《常微分方程》书上有个这样两个定理,①若x1(t),x2(2), 2020-06-06 …
11(2)若实数x,y满足:x/(2^10+5^3)+y/(2^10+6^3)=1,x/(3^10 2020-07-22 …
设y=f(x,t),且方程F(x,y,t)=0确定了t=t(x,y),求dy/dx457页的答案在 2020-07-22 …
求由参数方程x=2+ty=t-t^2在t=0相应点处的切线方程和法线方程 2020-07-31 …
设曲线x=x(t)y=y(t)由方程组tey+2x-y=2x+y+2t(1-t)=1确定,求曲线在 2020-07-31 …
求曲线x=t^2,y=1-t,z=t^3,在点(1,0,1)处的切线方程和法平面方程答案请写在纸上然 2020-11-01 …
1.在匀速直线运动中,下列关于公式V=S/T的说法正确的是:A速度v与路程s成正比.B速度v与时间t 2020-11-29 …
x=sinty=cos2t在t=π/4处;答案是2x√2+y-2=0x=3at/(1+t^2)y=3 2021-02-07 …