Browse Source

Add function notifyCustomer to show status after withdrawal

remotes/origin/feature/withdraw-money-system
Shivam Chaudhary 2 years ago
parent
commit
10d769ead8
  1. 19
      src/withdrawMoney.c

19
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");
}
}

Loading…
Cancel
Save