|
@ -2,16 +2,18 @@ |
|
|
#include "updateCustomerAccountBalance.c" |
|
|
#include "updateCustomerAccountBalance.c" |
|
|
#include "currentCustomerAccountBalance.c" |
|
|
#include "currentCustomerAccountBalance.c" |
|
|
|
|
|
|
|
|
void notifyCustomer(float amountToWithdraw, float remainingAccountBalance) { |
|
|
|
|
|
char returnToHomeInput; |
|
|
|
|
|
|
|
|
void notifyCustomer(float amountToWithdraw, float remainingAccountBalance, int user_id) { |
|
|
|
|
|
char c; |
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
|
|
|
printf("You have successfully withdrawn %.2f €.\n", amountToWithdraw); |
|
|
|
|
|
printf("Remaining account balance: %.2f €\n\n", remainingAccountBalance); |
|
|
|
|
|
printf("Would you like to do another withdrawal? [y] yes [any] no\n"); |
|
|
|
|
|
scanf(" %c", &c); |
|
|
|
|
|
|
|
|
if (returnToHomeInput) { |
|
|
|
|
|
//showAllMenuEntries(); |
|
|
|
|
|
|
|
|
if (c=='y'||c=='Y') { |
|
|
|
|
|
withdraw(user_id); |
|
|
|
|
|
}else{ |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -36,7 +38,7 @@ bool withdraw(int user_id) { |
|
|
remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance); |
|
|
remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance); |
|
|
updateSuccess = updateAvailableAccountBalance(user_id, remainingAccountBalance); |
|
|
updateSuccess = updateAvailableAccountBalance(user_id, remainingAccountBalance); |
|
|
if( updateSuccess ) { |
|
|
if( updateSuccess ) { |
|
|
notifyCustomer(amountToWithdraw, remainingAccountBalance); |
|
|
|
|
|
|
|
|
notifyCustomer(amountToWithdraw, remainingAccountBalance, user_id); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
@ -83,3 +85,7 @@ bool withdrawSpecificAmount(int user_id, float amountToWithdraw) { |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int main(){ |
|
|
|
|
|
withdraw(1234); |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |