diff --git a/src/depositMoney.c b/src/depositMoney.c index 093cc34..f5340b3 100644 --- a/src/depositMoney.c +++ b/src/depositMoney.c @@ -1,8 +1,9 @@ #include "depositMoney.h" #include "updateCustomerAccountBalance.c" -void askToTryAgain(bool afterError){ +void askToTryAgain(bool afterError, int customerID){ char choice; + printf("\n"); if(afterError){ printf("Would you like to try again? [y] yes [n] no: "); @@ -12,7 +13,7 @@ void askToTryAgain(bool afterError){ scanf(" %c", &choice); switch(choice){ case 'y': - depositMoney(1234,500); + depositMoney(customerID); break; case 'n': break; @@ -33,7 +34,7 @@ bool depositMoney(int customerID){ //InitiateDepositMoney(amountToDeposit,availableAccountBalance); if(updateAvailableAccountBalance(customerID, availableAccountBalance+amountToDeposit)==0){ printf("\nYou have successfully deposited %.2f. New account balance is %.2f", amountToDeposit, availableAccountBalance+amountToDeposit); - askToTryAgain(false); + askToTryAgain(false,customerID); return true; }else{ printf("Something went wrong. Please contact staff."); @@ -41,11 +42,11 @@ bool depositMoney(int customerID){ } }else if(amountToDeposit>0){ printf("The amount you entered is lower than the minimum amount."); - askToTryAgain(true); + askToTryAgain(true,customerID); return false; //amount lower than minimum deposit amount }else{ printf("Invalid input."); - askToTryAgain(true); + askToTryAgain(true,customerID); return false; //invalid input } return false;