diff --git a/src/sendmoney.c b/src/sendmoney.c deleted file mode 100644 index 7324077..0000000 --- a/src/sendmoney.c +++ /dev/null @@ -1,121 +0,0 @@ -#include "sendMoney.h" -#include "depositMoney.c" -#include "withdrawMoney.c" -#include "currencyExchange.c" - -void showBalance(int customerID){ - float balance=getAvailableAccountBalance(customerID); - printf("\n:.:.:.:.:.:"); - printf("\nYour current balance is %.2f.\n",balance); - printf(":.:.:.:.:.:\n"); -} - -float askToConvert(float input, int customerID){ - char c; - char symbol[]=""; - int id; - float converted; - printf("\nWould you like to convert the amount from € to another currency?[y] yes [any] no\n"); - scanf(" %c",&c); - if(c=='y'||c=='Y'){ - printf("\nPlease select from one of the following currencties to convert to:"); - printf("\n[1] USD"); - printf("\n[2] GBP"); - printf("\n[3] YEN"); - printf("\n[4] YUAN\n"); - scanf("%d",&id); - - if(id>0&&id<5){ - converted=convert(input,id); - }else{ - return 0; - } - switch(id){ - case 1: - symbol[0]='$'; - break; - case 2: - symbol[0]='P'; - break; - case 3: - symbol[0]='Y'; - break; - case 4: - symbol[0]='X'; - break; - } - printf("\nYou have successfuly transfered %.2f%s to [%d]",converted, symbol,customerID); - return converted; - }else{ - return 0; - } -} - -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){ - float availableAccountBalance=getAvailableAccountBalance(customerID); - float amountToSend; - int recID; - - showBalance(customerID); - printf("\nHow much would you like to send?\n"); - scanf("%f",&amountToSend); - if(amountToSend>0 && amountToSend1000){ - bool recExists=checkCustomerExists(recID); - if(recExists){ - if(recID==customerID){ - printf("\nYou cannot send money to yourself. Aborting. \n"); - return false; - } - else{ - if(withdrawSpecificAmount(customerID, amountToSend)){ - if(depositSpecificAmount(recID, amountToSend)){ - askToConvert(amountToSend, recID); - //printf("\nYou have successfuly transfered %.2f€ to [%d]",amountToSend,recID); - askToShowBalance(customerID); - return true; - } - else{ - printf("\nSomething went wrong with the transfer. Please contact staff."); - } - } - } - - }else{ - 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)){ - askToConvert(amountToSend, recID); - //printf("\nYou have successfuly transfered %.2f€ to [%d]\n",amountToSend,recID); - askToShowBalance(customerID); - return true; - } - } - } - else - { - printf("\nThe ID you have entered is not valid. Aborting. \n"); - } - - }else{ - //error - return false; - } - return false; -} - -// int main(){ -// sendMoney(1234); -// return 0; -// } \ No newline at end of file diff --git a/src/sendmoney.h b/src/sendmoney.h deleted file mode 100644 index df64387..0000000 --- a/src/sendmoney.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef SENDMONEY_H -#define SENDMONEY_H -#include -#include -#include -#include - -#define TRANSFER_FEE 0.8 -void showBalance(int customerID); -float askToConvert(float input, int customerID); -void askToShowBalance(int customerID); -bool sendMoney(int customerID); - -#endif // SENDMONEY_H