|
@ -1,7 +1,19 @@ |
|
|
#include "withdrawMoney.h" |
|
|
#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); |
|
|
float remainingAccountBalance = (availableAccountBalance - amountToWithdraw); |
|
|
|
|
|
|
|
|
return remainingAccountBalance; |
|
|
return remainingAccountBalance; |
|
@ -22,7 +34,10 @@ void withdraw(int user_id) { |
|
|
remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance); |
|
|
remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance); |
|
|
updateSuccess = updateAccountBalance(user_id, remainingAccountBalance); |
|
|
updateSuccess = updateAccountBalance(user_id, remainingAccountBalance); |
|
|
if( updateSuccess ) { |
|
|
if( updateSuccess ) { |
|
|
notifyCustomer(); |
|
|
|
|
|
|
|
|
notifyCustomer(amountToWithdraw, remainingAccountBalance); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
printf("Some error occured! Sorry for the inconvenience caused.\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|