Browse Source

Create initiateInterest function

remotes/origin/feature/balance-operations
fdlt3817 2 years ago
parent
commit
59caf4ad45
  1. 8
      src/interestCalculator.c
  2. 1
      src/interestCalculator.h
  3. 8
      src/sendmoney.c

8
src/interestCalculator.c

@ -17,6 +17,10 @@ void troubleshoot(int errorCode){
}
}
float initiateInterest(float principalAmount, float interest, float time){
return principalAmount*(1+(interest*time));
}
void calculateYearlyInterest(){
float principalAmount;
float interestPerYear;
@ -42,7 +46,7 @@ void calculateYearlyInterest(){
float interestDecimal=interestPerYear/100;
float result= principalAmount*(1+(interestDecimal*timeInYears));
float result= initiateInterest(principalAmount,interestDecimal,timeInYears);
printf("\nAmount with the interest is %.2f€.",result);
}
void calculateMonthlyInterest(){
@ -70,7 +74,7 @@ void calculateMonthlyInterest(){
float interestDecimal=interestPerMonth/100;
float result= principalAmount*(1+(interestDecimal*timeInMonths));
float result= initiateInterest(principalAmount,interestDecimal,timeInMonths);
printf("\nAmount with the interest is %.2f€.",result);
}

1
src/interestCalculator.h

@ -5,5 +5,6 @@
void calculateYearlyInterest();
void calculateMonthlyInterest();
float initiateInterest(float principalAmount, float interest, float time);
void troubleshoot(int errorCode);
#endif

8
src/sendmoney.c

@ -115,7 +115,7 @@ bool sendMoney(int customerID){
return false;
}
int main(){
sendMoney(1234);
return 0;
}
// int main(){
// sendMoney(1234);
// return 0;
// }
Loading…
Cancel
Save