diff --git a/src/CustomerData.txt b/src/CustomerData.txt index 106adfc..9d1f9d5 100644 --- a/src/CustomerData.txt +++ b/src/CustomerData.txt @@ -1,20 +1,34 @@ 1234=example ID=1234 -forename=Max -Surname=Mustermann +forename=Test +Surname=Testermann password=example -balance=2300 +balance=120.5 -1327=example -ID=1327 -forename=Max -Surname=Mustermann +1235=example +ID=1235 +forename=Test +Surname=Testermann password=example -balance=160 +balance=340 -1666=example -ID=1666 -forename=Max -Surname=Mustermann +1236=example +ID=1236 +forename=Test +Surname=Testermann password=example -balance=190 +balance=244.5 + +1237=example +ID=1237 +forename=Test +Surname=Testermann +password=example +balance=340 + +1238=example +ID=1238 +forename=Test +Surname=Testermann +password=example +balance=1200 diff --git a/src/withdrawMoney.c b/src/withdrawMoney.c index fd955c9..1f42417 100644 --- a/src/withdrawMoney.c +++ b/src/withdrawMoney.c @@ -2,16 +2,18 @@ #include "updateCustomerAccountBalance.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); updateSuccess = updateAvailableAccountBalance(user_id, remainingAccountBalance); if( updateSuccess ) { - notifyCustomer(amountToWithdraw, remainingAccountBalance); + notifyCustomer(amountToWithdraw, remainingAccountBalance, user_id); return true; } else { @@ -83,3 +85,7 @@ bool withdrawSpecificAmount(int user_id, float amountToWithdraw) { return false; } +int main(){ + withdraw(1234); + return 1; +} \ No newline at end of file diff --git a/src/withdrawMoney.h b/src/withdrawMoney.h index 972bf74..752c154 100644 --- a/src/withdrawMoney.h +++ b/src/withdrawMoney.h @@ -6,7 +6,7 @@ bool withdraw(int user_id); float initiateWithdraw(float amountToWithdraw, float availableAccountBalance); -void notifyCustomer(float amountToWithdraw, float remainingAccountBalance); +void notifyCustomer(float amountToWithdraw, float remainingAccountBalance, int user_id); bool withdrawSpecificAmount(int user_id, float amountToWithdraw); #endif \ No newline at end of file