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