diff --git a/src/CustomerData.txt b/src/CustomerData.txt index 9d1f9d5..2abaf86 100644 --- a/src/CustomerData.txt +++ b/src/CustomerData.txt @@ -3,7 +3,7 @@ ID=1234 forename=Test Surname=Testermann password=example -balance=120.5 +balance=117.5 1235=example ID=1235 diff --git a/src/withdrawMoney.c b/src/withdrawMoney.c index 1f42417..9ccf70a 100644 --- a/src/withdrawMoney.c +++ b/src/withdrawMoney.c @@ -29,10 +29,16 @@ bool withdraw(int user_id) { float remainingAccountBalance; 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: "); scanf("%f", &amountToWithdraw); - float availableAccountBalance = getAvailableAccountBalance(user_id); + if (amountToWithdraw > 0) { if (amountToWithdraw <= availableAccountBalance) { remainingAccountBalance = initiateWithdraw(amountToWithdraw, availableAccountBalance);