diff --git a/src/withdrawMoney.c b/src/withdrawMoney.c index 2c3e621..5502fec 100644 --- a/src/withdrawMoney.c +++ b/src/withdrawMoney.c @@ -1,7 +1,19 @@ #include "withdrawMoney.h" -float initiateWithdraw(float amountToWithdraw, float availableAccountBalance) { +void notifyCustomer(amountToWithdraw, remainingAccountBalance) { + char returnToHomeInput = NULL; + + printf("You have successfully withdrawn %f €.\n", amountToWithdraw); + printf("Remaining account balance: %f €\n\n", remainingAccountBalance); + printf("Press any key to return to home page: "); + scanf("%c", &returnToHomeInput); + + if (returnToHomeInput) { + showAllMenuEntries(); + } +} +float initiateWithdraw(float amountToWithdraw, float availableAccountBalance) { float remainingAccountBalance = (availableAccountBalance - amountToWithdraw); return remainingAccountBalance; @@ -22,7 +34,10 @@ void withdraw(int user_id) { remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance); updateSuccess = updateAccountBalance(user_id, remainingAccountBalance); if( updateSuccess ) { - notifyCustomer(); + notifyCustomer(amountToWithdraw, remainingAccountBalance); + } + else { + printf("Some error occured! Sorry for the inconvenience caused.\n"); } }