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. Vijos P1062 迎春舞会之交谊舞

    题目链接:https://vijos.org/p/1062 题意:输入n(n <= 1500)个女生左边有多少个男生.每个女生都和她左边最近的男生跳舞. 输出每个女生到可以与之跳舞的男生之间有几 ...

  2. Hadoop常见的45个问题解答

    (大讲台:国内首个it在线教育混合式自适应学习) 1.Hadoop集群可以运行的3个模式 单机(本地)模式 伪分布式模式 全分布式模式 2.  单机(本地)模式中的注意点? 在单机模式(standal ...

  3. redhat 5.4 下rabbitMQ单机安装.md

    1. 系统版本 `cat /etc/redhat-release` `Red Hat Enterprise Linux Server release 5.4 (Tikanga)`   2. 下载软件包 ...

  4. java三种工厂模式

    适用场合: 7.3 工厂模式的适用场合 创建新对象最简单的办法是使用new关键字和具体类.只有在某些场合下,创建和维护对象工厂所带来的额外复杂性才是物有所值.本节概括了这些场合. 7.3.1 动态实现 ...

  5. python 下载安装及setuptools应用

    1.首先下载python安装程序,下载地址:https://www.python.org/download/releases/2.7.8/ 如下图: 因为我的机器是32位的就选择了Windows x8 ...

  6. 几个.net的GUI控件库

    https://github.com/firstfloorsoftware/mui http://wpftoolkit.codeplex.com/ https://github.com/fluentr ...

  7. secondarynamenode异常

    secondarynamenode异常 -- ::, ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception ...

  8. Android ExpandableListView的简单应用

    Expandablelistview1Activity.java package com.wangzhu.demoexpandablelistview; import java.util.ArrayL ...

  9. easyui源码翻译1.32--Messager(消息窗口)

    前言 使用$.messager.defaults重写默认值对象.下载该插件翻译源码 消息窗口提供了不同的消息框风格,包含alert(警告框), confirm(确认框), prompt(提示框), p ...

  10. 集合对象(NSSet)

    main.m #import <Foundation/Foundation.h> @interface NSSet(printInteger) -(void)printSet; @end ...