From 10d769ead899ade0051c93015135aaed2de91f94 Mon Sep 17 00:00:00 2001 From: Shivam Chaudhary Date: Wed, 1 Feb 2023 21:10:00 +0100 Subject: [PATCH] Add function notifyCustomer to show status after withdrawal --- src/withdrawMoney.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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"); } }