Guest User

Untitled

a guest
Feb 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. public class Finance
  2. {
  3. public static double computeApy(double annualRate, int compoundingOption)
  4. {
  5. int N = 0;
  6. if(compoundingOption==1){
  7. N=365;
  8. }
  9. if(compoundingOption==2){
  10. N=12;
  11. }
  12. if(compoundingOption==3){
  13. N=1;
  14.  
  15. }
  16. double APY= (1+annualRate)/compoundingOption;
  17. APY=Math.pow(APY,N);
  18. APY=APY-1;
  19. return APY*100;
  20. }
  21.  
  22. public static double computeLoanPayment(
  23. double principal,
  24. double annualRate,
  25. double yearsDuration,
  26. int paymentOption)
  27. {
  28. double CLP= principal;
  29. CLP=CLP*annualRate(1+annualRate)Math.pow(CLP, N);
  30. CLP=CLP/(1+annualRate)Math.pow(CLP, N)-1;
  31. return CLP;
  32.  
  33.  
  34. }
  35. }
Add Comment
Please, Sign In to add comment