Browse Source

Refactor insterest calculator, remove unncessary files

remotes/origin/feature/loan-eligibility
fdlt3817 2 years ago
parent
commit
9b393734c3
  1. BIN
      src/depositMoney.dSYM/Contents/Resources/DWARF/depositMoney
  2. 26
      src/interestCalculator.c
  3. BIN
      src/updateCustomerAccountBalance.dSYM/Contents/Resources/DWARF/updateCustomerAccountBalance

BIN
src/depositMoney.dSYM/Contents/Resources/DWARF/depositMoney

26
src/interestCalculator.c

@ -23,22 +23,19 @@ void calculateYearlyInterest(){
float timeInYears; float timeInYears;
printf("Please enter the principal amount:"); printf("Please enter the principal amount:");
scanf("%f",&principalAmount);
if(principalAmount<=0){
if (scanf("%f", &principalAmount) != 1 || principalAmount <= 0) {
troubleshoot(0); troubleshoot(0);
return; return;
} }
printf("\nPlease enter interest per year (percentage):"); printf("\nPlease enter interest per year (percentage):");
scanf("%f",&interestPerYear);
if(interestPerYear<=0){
troubleshoot(1);
if (scanf("%f", &interestPerYear) != 1 || interestPerYear <= 0) {
troubleshoot(0);
return; return;
} }
printf("\nPlease enter interest time in years:"); printf("\nPlease enter interest time in years:");
scanf("%f",&timeInYears);
if(timeInYears<=0){
if (scanf("%f", &timeInYears) != 1 || timeInYears <= 0) {
troubleshoot(2); troubleshoot(2);
return; return;
} }
@ -46,7 +43,7 @@ void calculateYearlyInterest(){
float interestDecimal=interestPerYear/100; float interestDecimal=interestPerYear/100;
float result= principalAmount*(1+(interestDecimal*timeInYears)); float result= principalAmount*(1+(interestDecimal*timeInYears));
printf("\nAmount with the interest is %.2f.",result);
printf("\nAmount with the interest is %.2f.",result);
} }
void calculateMonthlyInterest(){ void calculateMonthlyInterest(){
float principalAmount; float principalAmount;
@ -54,22 +51,19 @@ void calculateMonthlyInterest(){
float timeInMonths; float timeInMonths;
printf("Please enter the principal amount:"); printf("Please enter the principal amount:");
scanf("%f",&principalAmount);
if(principalAmount<=0){
if (scanf("%f", &principalAmount) != 1 || principalAmount <= 0) {
troubleshoot(0); troubleshoot(0);
return; return;
} }
printf("\nPlease enter interest per month (percentage):"); printf("\nPlease enter interest per month (percentage):");
scanf("%f",&interestPerMonth);
if(interestPerMonth<=0){
troubleshoot(1);
if (scanf("%f", &interestPerMonth) != 1 || interestPerMonth <= 0) {
troubleshoot(0);
return; return;
} }
printf("\nPlease enter interest time in months:"); printf("\nPlease enter interest time in months:");
scanf("%f",&timeInMonths);
if(timeInMonths<=0){
if (scanf("%f", &timeInMonths) != 1 || timeInMonths <= 0) {
troubleshoot(2); troubleshoot(2);
return; return;
} }
@ -77,7 +71,7 @@ void calculateMonthlyInterest(){
float interestDecimal=interestPerMonth/100; float interestDecimal=interestPerMonth/100;
float result= principalAmount*(1+(interestDecimal*timeInMonths)); float result= principalAmount*(1+(interestDecimal*timeInMonths));
printf("\nAmount with the interest is %.2f.",result);
printf("\nAmount with the interest is %.2f.",result);
} }
void initiateCalculator(){ void initiateCalculator(){

BIN
src/updateCustomerAccountBalance.dSYM/Contents/Resources/DWARF/updateCustomerAccountBalance

Loading…
Cancel
Save