|
|
@ -3,23 +3,15 @@ |
|
|
|
#include "currentCustomerAccountBalance.h" |
|
|
|
|
|
|
|
void askToTryAgain(bool afterError, int customerID){ |
|
|
|
char choice; |
|
|
|
|
|
|
|
printf("\n"); |
|
|
|
if(afterError){ |
|
|
|
printf("Would you like to try again? [y] yes [n] no: "); |
|
|
|
}else{ |
|
|
|
printf("Would you like to make another deposit? [y] yes [n] no: "); |
|
|
|
} |
|
|
|
char choice; |
|
|
|
printf("%s [y] yes [n] no: ", afterError ? "Would you like to try again?" : "Would you like to make another deposit?"); |
|
|
|
scanf(" %c", &choice); |
|
|
|
switch(choice){ |
|
|
|
case 'y': |
|
|
|
depositMoney(customerID); |
|
|
|
break; |
|
|
|
case 'n': |
|
|
|
break; |
|
|
|
if (choice == 'y') { |
|
|
|
depositMoney(customerID); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
bool depositMoney(int customerID){ |
|
|
@ -34,12 +26,12 @@ bool depositMoney(int customerID){ |
|
|
|
scanf("%f", &amountToDeposit); |
|
|
|
|
|
|
|
if (amountToDeposit < 0) { |
|
|
|
printf("Invalid input."); |
|
|
|
printf("\nInvalid input."); |
|
|
|
askToTryAgain(true, customerID); |
|
|
|
return false; |
|
|
|
} |
|
|
|
else if (amountToDeposit < MINIMUM_DEPOSIT_AMOUNT) { |
|
|
|
printf("The amount you entered is lower than the minimum amount."); |
|
|
|
printf("\nThe amount you entered is lower than the minimum amount."); |
|
|
|
askToTryAgain(true, customerID); |
|
|
|
return false; |
|
|
|
} |
|
|
@ -50,7 +42,7 @@ bool depositMoney(int customerID){ |
|
|
|
return true; |
|
|
|
} |
|
|
|
else { |
|
|
|
printf("Something went wrong. Please contact staff."); |
|
|
|
printf("\nSomething went wrong. Please contact staff."); |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|