Browse Source

Add function to return to home page after completion of withdrawal

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

9
src/withdrawMoney.c

@ -1,13 +1,18 @@
#include "withdrawMoney.h" #include "withdrawMoney.h"
void initiateWithdraw(float amountToWithdraw, float availableAccountBalance) { void initiateWithdraw(float amountToWithdraw, float availableAccountBalance) {
char returnToHomeInput = NULL;
float remainingAccountBalance = (availableAccountBalance - amountToWithdraw); float remainingAccountBalance = (availableAccountBalance - amountToWithdraw);
updateAccountBalance(remainingAccountBalance); updateAccountBalance(remainingAccountBalance);
printf("You have successfully withdrawn %f €.\n", amountToWithdraw); printf("You have successfully withdrawn %f €.\n", amountToWithdraw);
printf("Remaining account balance: %f €\n\n", remainingAccountBalance); printf("Remaining account balance: %f €\n\n", remainingAccountBalance);
printf("Press any key to return to home page: "); printf("Press any key to return to home page: ");
// go to home page
scanf("%c", &returnToHomeInput);
if (returnToHomeInput) {
showAllMenuEntries();
}
} }
void withdraw() { void withdraw() {
@ -29,7 +34,7 @@ void withdraw() {
withdraw(); withdraw();
} }
else { else {
// return to home page
showAllMenuEntries();
} }
} }
} }

Loading…
Cancel
Save