首页 > 其他 > 详细

利率计算v4.0--测试--软件工程

时间:2016-03-30 11:01:35      阅读:206      评论:0      收藏:0      [点我收藏+]
利率计算v4.0--测试
package Test;

import Model.Interest;
import Service.CompoundInterestService;
import Service.OrInterestService;
import Service.PrincipalService;
import Service.SingleInterestService;
import org.junit.Test;

/**
 * Created by pc on 2016/3/28.
 */
public class TestInterest {
    @Test
    public void testInterest(){
        Interest interest = new Interest(0.5,1000,10);
        System.out.println(interest.getInterest() +" "+ interest.getPrincipal() +" "+ interest.getYear());
    }

    @Test
    public void testOrInterest(){
        Interest interest = new Interest(0.5,1000,10);
        System.out.println(new OrInterestService().orInterest("compound" , interest));
        System.out.println(new OrInterestService().orInterest("single" , interest));
    }

    @Test
    public void testCompoundInterest(){
        Interest interest = new Interest(0.5,1000,10);
        System.out.println(new CompoundInterestService().calculate(interest));
    }

    @Test
    public void testSingleInterest(){
        Interest interest = new Interest(0.5,1000,10);
        System.out.println(new SingleInterestService().calculate(interest));
    }

    @Test
    public void testPrincipal(){
        Interest interest = new Interest();
        interest.setAmount(1000);
        interest.setYear(10);
        interest.setInterest(0.5);
        System.out.println(new PrincipalService().calculate(interest));
    }

    @Test
    public void testYear(){
        Interest interest = new Interest();
        interest.setAmount(1000);
        interest.setPrincipal(10000);
        interest.setInterest(0.5);
        System.out.println(new PrincipalService().calculate(interest));
    }

    @Test
    public void testLong(){
        Interest interest = new Interest();
        interest.setAmount(1000000000);
        interest.setPrincipal(1000000000);
        interest.setInterest(0.000000000001);
        System.out.println(new PrincipalService().calculate(interest));
    }

    @Test
    public void test_01(){
        Interest interest = new Interest();
        interest.setAmount(1);
        interest.setPrincipal(1);
        interest.setInterest(1);
        System.out.println(new PrincipalService().calculate(interest));
    }

}
<script type="text/javascript">
      function check(form){
        if (document.forms.compoundInterest.principal.value == ""){
          alert("请输入本金 !");
          document.forms.compoundInterest.principal.focus();
          return false;
        }
        if (document.forms.compoundInterest.interestRate.value == ""){
          alert("请输入利率 !");
          document.forms.compoundInterest.interestRate.focus();
          return false;
        }
        if (document.forms.compoundInterest.year.value == ""){
          alert("请输入年份 !");
          document.forms.compoundInterest.year.focus();
          return false;
        }
      }
    </script>

计算终值

(本金,年限,利率,次数)

终值

 运行结果  bug跟踪

1

 

 

 

 

2

 

 

 

 

 

3

 

 

 

 

       

利率计算v4.0--测试--软件工程

原文:http://www.cnblogs.com/caishun/p/5336223.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!