|
@ -2,11 +2,21 @@ |
|
|
#include "depositMoney.c" |
|
|
#include "depositMoney.c" |
|
|
#include "withdrawMoney.c" |
|
|
#include "withdrawMoney.c" |
|
|
|
|
|
|
|
|
|
|
|
void showBalance(int customerID){ |
|
|
|
|
|
float balance=getAvailableAccountBalance(customerID); |
|
|
|
|
|
printf("\n:.:.:.:.:.:"); |
|
|
|
|
|
printf("\nYour current balance is %.2f.\n",balance); |
|
|
|
|
|
printf(":.:.:.:.:.:\n"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool sendMoney(int customerID){ |
|
|
bool sendMoney(int customerID){ |
|
|
float availableAccountBalance=getAvailableAccountBalance(customerID); |
|
|
float availableAccountBalance=getAvailableAccountBalance(customerID); |
|
|
float amountToSend; |
|
|
float amountToSend; |
|
|
int recID; |
|
|
int recID; |
|
|
printf("\nYou have %.2f€ in your account. How much would you like to send?\n",availableAccountBalance); |
|
|
|
|
|
|
|
|
char c; |
|
|
|
|
|
showBalance(customerID); |
|
|
|
|
|
printf("\nHow much would you like to send?\n"); |
|
|
scanf("%f",&amountToSend); |
|
|
scanf("%f",&amountToSend); |
|
|
if(amountToSend>0 && amountToSend<availableAccountBalance){ |
|
|
if(amountToSend>0 && amountToSend<availableAccountBalance){ |
|
|
printf("\nYour input was %.2f€. Please enter the recipient id.\n",amountToSend); |
|
|
printf("\nYour input was %.2f€. Please enter the recipient id.\n",amountToSend); |
|
@ -31,8 +41,14 @@ bool sendMoney(int customerID){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}else{ |
|
|
}else{ |
|
|
if(withdrawSpecificAmount(customerID, amountToSend)){ |
|
|
|
|
|
printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID); |
|
|
|
|
|
|
|
|
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)){ |
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|