|
@ -9,12 +9,21 @@ void showBalance(int customerID){ |
|
|
printf(":.:.:.:.:.:\n"); |
|
|
printf(":.:.:.:.:.:\n"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void askToShowBalance(int customerID){ |
|
|
|
|
|
char c; |
|
|
|
|
|
printf("\nWould you like to see your remaining balance? [y] yes [any] no\n"); |
|
|
|
|
|
scanf(" %c",&c); |
|
|
|
|
|
if(c=='y' || c=='Y'){ |
|
|
|
|
|
showBalance(customerID); |
|
|
|
|
|
} |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bool sendMoney(int customerID){ |
|
|
bool sendMoney(int customerID){ |
|
|
float availableAccountBalance=getAvailableAccountBalance(customerID); |
|
|
float availableAccountBalance=getAvailableAccountBalance(customerID); |
|
|
float amountToSend; |
|
|
float amountToSend; |
|
|
int recID; |
|
|
int recID; |
|
|
char c; |
|
|
|
|
|
|
|
|
|
|
|
showBalance(customerID); |
|
|
showBalance(customerID); |
|
|
printf("\nHow much would you like to send?\n"); |
|
|
printf("\nHow much would you like to send?\n"); |
|
|
scanf("%f",&amountToSend); |
|
|
scanf("%f",&amountToSend); |
|
@ -32,6 +41,7 @@ bool sendMoney(int customerID){ |
|
|
if(withdrawSpecificAmount(customerID, amountToSend)){ |
|
|
if(withdrawSpecificAmount(customerID, amountToSend)){ |
|
|
if(depositSpecificAmount(recID, amountToSend)){ |
|
|
if(depositSpecificAmount(recID, amountToSend)){ |
|
|
printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID); |
|
|
printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID); |
|
|
|
|
|
askToShowBalance(customerID); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
else{ |
|
|
else{ |
|
@ -44,11 +54,7 @@ bool sendMoney(int customerID){ |
|
|
printf("\nThis ID is not from a customer of our bank. A transfer fee of %.2f€ will be taken.\n", TRANSFER_FEE); |
|
|
printf("\nThis ID is not from a customer of our bank. A transfer fee of %.2f€ will be taken.\n", TRANSFER_FEE); |
|
|
if(withdrawSpecificAmount(customerID, amountToSend+TRANSFER_FEE)){ |
|
|
if(withdrawSpecificAmount(customerID, amountToSend+TRANSFER_FEE)){ |
|
|
printf("\nYou have successfuly transfered %.2f€ to [%d]\n",amountToSend,recID); |
|
|
printf("\nYou have successfuly transfered %.2f€ to [%d]\n",amountToSend,recID); |
|
|
printf("\nWould you like to see your remaining balance? [y] yes [any] no\n"); |
|
|
|
|
|
scanf(" %c",&c); |
|
|
|
|
|
if(c=='y' || c=='Y'){ |
|
|
|
|
|
showBalance(customerID); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
askToShowBalance(customerID); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|