Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Finance
- {
- public static double computeApy(double annualRate, int compoundingOption)
- {
- int N = 0;
- if(compoundingOption==1){
- N=365;
- }
- if(compoundingOption==2){
- N=12;
- }
- if(compoundingOption==3){
- N=1;
- }
- double APY= (1+annualRate)/compoundingOption;
- APY=Math.pow(APY,N);
- APY=APY-1;
- return APY*100;
- }
- public static double computeLoanPayment(
- double principal,
- double annualRate,
- double yearsDuration,
- int paymentOption)
- {
- double CLP= principal;
- CLP=CLP*annualRate(1+annualRate)Math.pow(CLP, N);
- CLP=CLP/(1+annualRate)Math.pow(CLP, N)-1;
- return CLP;
- }
- }
Add Comment
Please, Sign In to add comment