Browse Source

Create error outputs

remotes/origin/feature/loan-eligibility
fdlt3817 2 years ago
parent
commit
e7810a357f
  1. 9
      src/sendmoney.c

9
src/sendmoney.c

@ -9,7 +9,7 @@ bool sendMoney(int customerID){
printf("\nYou have %.2f€ in your account. How much would you like to send?\n",availableAccountBalance); printf("\nYou have %.2f€ in your account. How much would you like to send?\n",availableAccountBalance);
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");
printf("\nYour input was %.2f€. Please enter the recipient id.\n",amountToSend);
scanf("%d",&recID); scanf("%d",&recID);
if(recID>1000){ if(recID>1000){
bool recExists=checkCustomerExists(recID); bool recExists=checkCustomerExists(recID);
@ -19,6 +19,8 @@ bool sendMoney(int customerID){
printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID); printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID);
return true; return true;
} }
}else{
printf("\nSomething went wrong with the transfer. Please contact staff.");
} }
}else{ }else{
if(withdrawSpecificAmount(customerID, amountToSend)){ if(withdrawSpecificAmount(customerID, amountToSend)){
@ -27,6 +29,11 @@ bool sendMoney(int customerID){
} }
} }
} }
else
{
printf("\nThe ID you have entered is not valid. Aborting. \n");
}
}else{ }else{
//error //error
return false; return false;

Loading…
Cancel
Save