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. node.js&mongodb&express 搭建个人博客系统

    源码参见于 https://github.com/njaulj/iliujun

  2. hdu 5646 DZY Loves Partition 二分+数学分析+递推

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=5646 题意:将n分成k个正整数之和,要求k个数全部相同:并且这k个数的乘积最大为多少?结果mod 1e^9 ...

  3. Java使用memcached

    1.加载commons-pool-1.5.6.jar.java_memcached-release_2.6.6.jar.slf4j-api-1.6.1.jar.slf4j-simple-1.6.1.j ...

  4. Hyper-V中安装CentOS分辨率修改

    Hyper-V还是极好用的,不过对linux的支持优点问题, 比如默认情况,linux分辨率被锁定了,这里有一个比较简单的方法修改,针对CentOS grubby --update-kernel=AL ...

  5. JAVA自学之-----FileInputStream类

    1, FileInputStream类函数创建: package coreJava; import java.io.FileInputStream; import java.io.IOExceptio ...

  6. WCF 消息压缩性能问题及解决方法

    最近使用WCF作为通迅框架开发一套信息系统,系统使用传统C/S框架,系统有可能会部署在互联网上,因此决定对传输的数据进行GZIP压缩,原来在使用.NET Remoting时,可以使用插入自定义的Cha ...

  7. SQL分组查询GroupBy

    一.分组查询1.使用group by进行分组查询在使用group by关键字时,在select列表中可以指定的项目是有限制的,select语句中仅许以下几项:〉被分组的列〉为每个分组返回一个值得表达式 ...

  8. 练习--LINUX进程间通信之无名管道PIPE

    IBM上放的这个系统不错,刚好可以系统回温一下LINUX的系统知识. http://www.ibm.com/developerworks/cn/linux/l-ipc/part1/ 感觉年纪大了,前几 ...

  9. Percona Xtrabackup备份mysql全库及指定数据库(完整备份与增量备份)

    原文地址:http://www.tuicool.com/articles/RZRnq2 Xtrabackup简介 Percona XtraBackup是开源免费的MySQL数据库热备份软件,它能对In ...

  10. POJ - 1523 SPF

    题目要求割顶集,并且还要求出去掉割顶之后剩下的图连通数目. tarjan算法求出割顶后直接枚举就可以了吧. 一开始想到利用iscut[u]的次数也就是点u被判定为割顶的次数求连通分量数,还有利用与结点 ...