JAVA语言程序设计 第8版 复习题2.13 求高人指点 javaSE 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import java.util.Scanner;public class Test{ public static void main(String[] args){ // Create an new Scanner Scanner input=new Scanner(System.in); //提示输入投资总额 System.out.print("Enter investement amount:"); double investmentAmount=input.nextDouble(); //提示输入月利率 System.out.print("Enter annual interest rate:"); double annualInvestmentRate=input.nextDouble()*0.01; //提示输入投资年限 System.out.print("Enter number of years:"); Integer numberOfyears=input.nextInt(); //计算未来的投资额 double futureInvestmentValue=investmentAmount*Math.pow(1+annualInvestmentRate/12, numberOfyears*12); //计算年利率 //double annualInterestRate=monthlyInvestmentRate*12; //double futureInvestmentValue=investmentAmount*(Math.pow(1+annualInterestRate,numberOfyears)); //输出结果 System.out.printf("Accumulated value is : %.2f",futureInvestmentValue); }}题目让输入的应该是年利率吧。 monthlyInterestRate 是 月利率的意思 如果是年利率的话就不用 numberOfyears*12 求各位前辈指导,谢谢了 Xmx只能设到1.8G吗,我机器8g内存,怎么才能不浪费呢 socket服务器端线程卡死 问一个java中对象赋值和是否相等的问题 ThreadLocal 问题 用java如何打开 顺序读完一个文件后如何跳回文件开头 jbuilder 7---救急!!! 简单问题,送你20分! java 初学者需要看懂源代码吗? hibernateTemplate 跟 存储过程 执行 先后问题 求一个JAVA POST请求登录网站的代码
public static void main(String[] args){
// Create an new Scanner
Scanner input=new Scanner(System.in); //提示输入投资总额
System.out.print("Enter investement amount:");
double investmentAmount=input.nextDouble(); //提示输入月利率
System.out.print("Enter annual interest rate:");
double annualInvestmentRate=input.nextDouble()*0.01; //提示输入投资年限
System.out.print("Enter number of years:");
Integer numberOfyears=input.nextInt(); //计算未来的投资额
double futureInvestmentValue=investmentAmount*Math.pow(1+annualInvestmentRate/12, numberOfyears*12);
//计算年利率
//double annualInterestRate=monthlyInvestmentRate*12;
//double futureInvestmentValue=investmentAmount*(Math.pow(1+annualInterestRate,numberOfyears)); //输出结果
System.out.printf("Accumulated value is : %.2f",futureInvestmentValue);
}
}
题目让输入的应该是年利率吧。