public class Solution
 {
     public static void main(String[] args)
     {
         double rate = 0.05;
         double balance = 10000;
         double sum = 0;

         for(int i = 0; i < 10; i++)
             balance = balance * (1 + rate);

         System.out.println("The cost after 10 years is " + balance);

         for(int i = 0; i < 4; i++)
         {
             balance = balance * (1 + rate);
             sum += balance;
         }

         System.out.println("The total cost of 4 years: " + sum);
     }
 }

HW4.7的更多相关文章

  1. HW4.46

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

  2. HW4.45

    public class Solution { public static void main(String[] args) { int count = 0; for(int i = 1; i < ...

  3. HW4.44

    public class Solution { public static void main(String[] args) { double randX; double randY; int hit ...

  4. HW4.43

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

  5. HW4.42

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

  6. HW4.41

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

  7. HW4.40

    public class Solution { public static void main(String[] args) { long positiveSide = 0; long negativ ...

  8. HW4.39

    public class Solution { public static void main(String[] args) { double sum; double baseSalary = 500 ...

  9. HW4.38

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

  10. HW4.37

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

随机推荐

  1. about Q&A in installing linux[centos6,7]

    keywords:grub1,grub2,gnome,kde, question describe:install centos7 by U disk,出现问题, 解决办法: install cent ...

  2. Codeforces Round #345 (Div. 1) B. Image Preview

    Vasya's telephone contains n photos. Photo number 1 is currently opened on the phone. It is allowed ...

  3. vi/vim正则表达式

    http://www.cnblogs.com/penseur/archive/2011/02/25/1964522.html 毋庸多言,在vim中正则表达式得到了十分广泛的应用. 最常用的 / 和 : ...

  4. 3、MapReduce

    MapReduce是一种处理海量数据的并行编程模型和计算框架,用于对大数据及的并行计算. 1.MapReduce基础 1)MapReduce处理数据集过程,如下图: a)Map阶段: MapReduc ...

  5. SIAlertView

    SIAlertView是AlertView的替代产品 的效果比较多 . 使用实例: SIAlertView *alertView = [[SIAlertView alloc] initWithTitl ...

  6. ASP.NET MVC 入门3、Routing

    本系列文章基于Microsoft ASP.NET MVC Beta. 在一个route中,通过在大括号中放一个占位符来定义( { and } ).当解析URL的时候,符号"/"和& ...

  7. 关于安装完Node.js 出现node is not dedined 问题

    今天想来接触下Node.js 神奇  怀着揣揣的心 从官网下载了windows 的64位mis版本  几个下一步就顺利安装完毕了 接着跟着新手教程走  不懂教程里的 苹果shell 是什么 反正就是检 ...

  8. 商务部公开微软持有的Android技术专利

    微软与众多Android厂商签署了专利授权协议,但从来没有公开它持有多少项Android技术专利.出人意料的是,为了收购诺基亚手机业务,微软今年4月递交到中国商务部的文件中完整公开了它的Android ...

  9. CreateObject("Wscript.Shell")用法

    WScript.Shell是WshShell对象的ProgID,创建WshShell对象可以运行程序.操作注册表.创建快捷方式.访问系统文件夹.管理环境变量. 该对象有一个run方法. Run 方法创 ...

  10. BMS 项目过程中遇到的问题

    环境搭建的问题 Git的ssh私人密钥问题, 路劲不正确的话使用ssh方式连接github进行远程push或clone会出现需要输入密码而怎么输入都不正确的情况,这个时候使用下面的办法: http方面 ...