Browse Source

Display balance in withdrawMoney

remotes/origin/feature/balance-operations
fdlt3817 2 years ago
parent
commit
0dca8f8422
  1. 2
      src/CustomerData.txt
  2. 8
      src/withdrawMoney.c

2
src/CustomerData.txt

@ -3,7 +3,7 @@ ID=1234
forename=Test forename=Test
Surname=Testermann Surname=Testermann
password=example password=example
balance=120.5
balance=117.5
1235=example 1235=example
ID=1235 ID=1235

8
src/withdrawMoney.c

@ -29,10 +29,16 @@ bool withdraw(int user_id) {
float remainingAccountBalance; float remainingAccountBalance;
bool updateSuccess = false; bool updateSuccess = false;
float availableAccountBalance = getAvailableAccountBalance(user_id);
printf("\n:.:.:.:.:.:");
printf("\nYour current balance is %.2f.\n",availableAccountBalance);
printf(":.:.:.:.:.:\n");
printf("Enter amount to withdraw: "); printf("Enter amount to withdraw: ");
scanf("%f", &amountToWithdraw); scanf("%f", &amountToWithdraw);
float availableAccountBalance = getAvailableAccountBalance(user_id);
if (amountToWithdraw > 0) { if (amountToWithdraw > 0) {
if (amountToWithdraw <= availableAccountBalance) { if (amountToWithdraw <= availableAccountBalance) {
remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance); remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance);

Loading…
Cancel
Save