Interest rate calculation v4.0--test--Software engineering

Source: Internet
Author: User

Interest rate calculation v4.0--test
 PackageTest;Importmodel.interest;ImportService.compoundinterestservice;ImportService.orinterestservice;ImportService.principalservice;ImportService.singleinterestservice;Importorg.junit.Test;/*** Created by PC on 2016/3/28.*/ Public classtestinterest {@Test Public voidtestinterest () {Interest Interest=NewInterest (0.5,1000,10); System.out.println (Interest.getinterest ()+ "" + interest.getprincipal () + "+" +interest.getyear ()); } @Test Public voidtestorinterest () {Interest Interest=NewInterest (0.5,1000,10); System.out.println (NewOrinterestservice (). Orinterest ("Compound", interest)); System.out.println (NewOrinterestservice (). Orinterest ("single", interest)); } @Test Public voidtestcompoundinterest () {Interest Interest=NewInterest (0.5,1000,10); System.out.println (NewCompoundinterestservice (). Calculate (interest)); } @Test Public voidtestsingleinterest () {Interest Interest=NewInterest (0.5,1000,10); System.out.println (NewSingleinterestservice (). Calculate (interest)); } @Test Public voidTestprincipal () {Interest Interest=NewInterest (); Interest.setamount (1000); Interest.setyear (10); Interest.setinterest (0.5); System.out.println (NewPrincipalservice (). Calculate (interest)); } @Test Public voidtestyear () {Interest Interest=NewInterest (); Interest.setamount (1000); Interest.setprincipal (10000); Interest.setinterest (0.5); System.out.println (NewPrincipalservice (). Calculate (interest)); } @Test Public voidTestlong () {Interest Interest=NewInterest (); Interest.setamount (1000000000); Interest.setprincipal (1000000000); Interest.setinterest (0.000000000001); System.out.println (NewPrincipalservice (). Calculate (interest)); } @Test Public voidtest_01 () {Interest Interest=NewInterest (); Interest.setamount (1); Interest.setprincipal (1); Interest.setinterest (1); System.out.println (NewPrincipalservice (). Calculate (interest)); }}
<script type= "Text/javascript" >functionCheck (form) {if(Document.forms.compoundInterest.principal.value = = "") {alert ("Please enter the principal!" ");          Document.forms.compoundInterest.principal.focus (); return false; }        if(Document.forms.compoundInterest.interestRate.value = = "") {alert ("Please enter the interest rate!" ");          Document.forms.compoundInterest.interestRate.focus (); return false; }        if(Document.forms.compoundInterest.year.value = = "") {alert ("Please enter the year!" ");          Document.forms.compoundInterest.year.focus (); return false; }      }    </script>

Calculate the end value

(Principal, duration, interest rate, number of times)

Final value

Run results Bug tracking

1

2

3

...

Interest rate calculation v4.0--test--Software engineering

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.