import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);

         System.out.print("The amount invested: ");
         double investAmount = input.nextDouble();
         System.out.print("Annual interest rate: ");
         double annualInterestRate = input.nextDouble();

         input.close();

         System.out.printf("%s\t%s\n", "Years", "Future Value");

         for(int i = 1; i <= 30; i++)
             System.out.printf("%d\t%f\n", i, futureInvestmentValue(investAmount, annualInterestRate / 12, i));
     }

     public static double futureInvestmentValue(double investmentAmount, double monthlyInterestRate, int years)
     { return investmentAmount * Math.pow((1 + monthlyInterestRate), (years * 12)); }
 }

HW5.7的更多相关文章

  1. HW5.36

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  2. HW5.35

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  3. HW5.34

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  4. HW5.33

    import java.util.Calendar; public class Solution { public static void main(String[] args) { long tot ...

  5. HW5.32

    public class Solution { public static void main(String[] args) { int n1 = (int)(Math.random() * 5 + ...

  6. HW5.31

    import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner i ...

  7. HW5.30

    public class Solution { public static void main(String[] args) { for(int i = 3; i <= 1000; i++) i ...

  8. HW5.29

    public class Solution { public static void main(String[] args) { int n1 = (int)(Math.random() * 5 + ...

  9. HW5.28

    public class Solution { public static void main(String[] args) { System.out.printf("%s\t%s\n&qu ...

  10. HW5.27

    public class Solution { public static void main(String[] args) { int totalCount = 0; int lineCount = ...

随机推荐

  1. <五> jQuery 效果

    显示隐藏 $("selector").show(speed, callback) $("selector").hide"(speed, callbac ...

  2. pair work-Elevator Schedule

    编程人员:周敏轩 192 周萱 149 1 有关结对编程的思考 结对编程技术是指两位程序员肩并肩地坐在同一台电脑前合作完成同一个设计.同一个算法.同一段代码或同一组测试.通过这次的结对编程练习我结识了 ...

  3. 实时动态更新曲线图,x轴时间s随数据的变化而变化

    $(function () {    $(document).ready(function () {        Highcharts.setOptions({            global: ...

  4. POJ 2186 Popular Cows(Tarjan)

    http://poj.org/problem?id=2186 题意 :给你n头牛,m对关系,每对关系由两个编号组成,u和v代表着u认为v是受欢迎的,如果1认为2是受欢迎的,2认为3是受欢迎的,那1认为 ...

  5. HDU4535+公式

    错排公式. 用64位! /* */ #include<stdio.h> #include<string.h> #include<stdlib.h> #include ...

  6. http://blog.csdn.net/shirdrn/article/details/6270506

    http://blog.csdn.net/shirdrn/article/details/6270506

  7. 安装Ubuntu服务器

    安装edX首先需要一台linux或Mac系统的电脑/服务器. 这里以常见的Ubuntu作为服务器系统. Ubuntu的官方网站为http://www.ubuntu.com,中文网站为http://ht ...

  8. Java中堆和栈创建对象的区别

    http://blog.csdn.net/hbhhww/article/details/8152838

  9. SPRING IN ACTION 第4版笔记-第五章BUILDING SPRING WEB APPLICATIONS-003-示例项目用到的类及配置文件

    一.配置文件 1.由于它继承AbstractAnnotationConfigDispatcherServletInitializer,Servlet容器会把它当做配置文件 package spittr ...

  10. Delphi实现多个图像相互覆盖时无内容处点击穿透

    http://www.52delphi.com/list.asp?ID=1405 CM_HITTEST是Delphi自定义的控件消息