|
|
@ -0,0 +1,30 @@ |
|
|
|
#include <stdio.h> |
|
|
|
|
|
|
|
void withdraw() { |
|
|
|
float amountToWithdraw; |
|
|
|
char tryDifferentAmount; |
|
|
|
|
|
|
|
float availableAccountBalance = getAvailableAccountBalance(); |
|
|
|
|
|
|
|
printf("Enter amount to withdraw: "); |
|
|
|
scanf("%f", &amountToWithdraw); |
|
|
|
if (amountToWithdraw > 0) { |
|
|
|
if (amountToWithdraw <= availableAccountBalance) { |
|
|
|
initiateWithdraw(amountToWithdraw, availableAccountBalance); |
|
|
|
} |
|
|
|
else { |
|
|
|
printf("You don't have sufficient money to withdraw. Do you want to try different amount?\n[y]: Yes, any other key : exit"); |
|
|
|
scanf(" %c", &tryDifferentAmount); |
|
|
|
if (tryDifferentAmount == 'Y' || tryDifferentAmount == 'y') { |
|
|
|
withdraw(); |
|
|
|
} |
|
|
|
else { |
|
|
|
// return to home page |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
printf("Invalid Input! Please try again.\n"); |
|
|
|
withdraw(); |
|
|
|
} |
|
|
|
} |