From dd623e421903668641bb9022879ac211a9ea5e2d Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 14:56:44 +0100 Subject: [PATCH 1/9] Implement enter month option to interestCalculator --- src/depositMoney.c | 4 ++-- src/interestCalculator.c | 27 +++++++++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/depositMoney.c b/src/depositMoney.c index 5732f7e..33a4e2d 100644 --- a/src/depositMoney.c +++ b/src/depositMoney.c @@ -1,6 +1,6 @@ #include "depositMoney.h" -#include "updateCustomerAccountBalance.h" -#include "currentCustomerAccountBalance.h" +#include "updateCustomerAccountBalance.c" +#include "currentCustomerAccountBalance.c" void askToTryAgain(bool afterError, int customerID){ char choice; diff --git a/src/interestCalculator.c b/src/interestCalculator.c index d9c2cce..6998887 100644 --- a/src/interestCalculator.c +++ b/src/interestCalculator.c @@ -14,6 +14,9 @@ void troubleshoot(int errorCode){ case 2: printf("Duration not valid. Make sure it is a valid number over the value of zero."); break; + case 3: + printf("Invalid option. Aborting."); + break; } } @@ -25,6 +28,7 @@ void calculateYearlyInterest(){ float principalAmount; float interestPerYear; float timeInYears; + int choice; printf("Please enter the principal amount:"); if (scanf("%f", &principalAmount) != 1 || principalAmount <= 0) { @@ -37,13 +41,28 @@ void calculateYearlyInterest(){ troubleshoot(0); return; } - - printf("\nPlease enter interest time in years:"); - if (scanf("%f", &timeInYears) != 1 || timeInYears <= 0) { + printf("\nWould you like to enter the time in [1]months or in [2]years?\n"); + scanf("%d",&choice); + if(choice==1){ + printf("\nPlease enter interest time in months:"); + if (scanf("%f", &timeInYears) != 1 || timeInYears <= 0) { + troubleshoot(2); + return; + } + timeInYears=timeInYears/12; + + }else if(choice==2){ + printf("\nPlease enter interest time in years:"); + if (scanf("%f", &timeInYears) != 1 || timeInYears <= 0) { + troubleshoot(2); + return; + } + }else{ troubleshoot(2); - return; } + + float interestDecimal=interestPerYear/100; float result= initiateInterest(principalAmount,interestDecimal,timeInYears); From acc3fd487da39e38c0d50e6e1e2240d8d4401598 Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 14:57:51 +0100 Subject: [PATCH 2/9] Create simple test for depositMoney --- tests/test_depositMoney.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/test_depositMoney.c diff --git a/tests/test_depositMoney.c b/tests/test_depositMoney.c new file mode 100644 index 0000000..39a8b33 --- /dev/null +++ b/tests/test_depositMoney.c @@ -0,0 +1,39 @@ +#ifdef TEST + +#include "unity.h" +#include "depositMoney.h" + +void setUp(void) +{ +} + +void tearDown(void) +{ +} + +void test_depositSpecificAmount(void) { + + /* Arrange */ + + int length = 5; + int userIDs[] = {1234,1235,1236,1237,1238}; + float amountToDeposit[] = {200.5, 340, 244.5, 340, 1200}; + + bool result[length]; + + /* Act */ + + for (int i = 0; i < length; i++) { + result[i] = depositSpecificAmount( userIDs[i], amountToDeposit[i] ); + } + + /* Assert */ + + for (int i = 0; i < length; i++) { + TEST_ASSERT_TRUE(result[i]); + } + +} + + +#endif // TEST From 9bf38a1487c760f9ad8b65839baaca55b4b9e574 Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 15:12:49 +0100 Subject: [PATCH 3/9] Create function to set saving goal --- src/interestCalculator.c | 25 ++++++++++++++++++++++--- src/interestCalculator.h | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/interestCalculator.c b/src/interestCalculator.c index 6998887..0764a39 100644 --- a/src/interestCalculator.c +++ b/src/interestCalculator.c @@ -20,6 +20,24 @@ void troubleshoot(int errorCode){ } } +void askForSavingGoal(float principalAmount, float accInterestPerYear){ + char c; + float goal; + float timeForGoal; + printf("\nWould you like to set a saving goal?"); + scanf(" %c",&c); + + if(c=='y'||c=='Y'){ + printf("\nPlease enter your goal amount in €:"); + scanf("%f",&goal); + timeForGoal=(goal-principalAmount)/accInterestPerYear; + printf("In %.1f years you will reach your goal of %f.\n", timeForGoal, goal); + }else{ + //error + } + +} + float initiateInterest(float principalAmount, float interest, float time){ return principalAmount*(1+(interest*time)); } @@ -67,6 +85,7 @@ void calculateYearlyInterest(){ float result= initiateInterest(principalAmount,interestDecimal,timeInYears); printf("\nAmount with the interest is %.2f€.",result); + askForSavingGoal(principalAmount,principalAmount*interestDecimal); } void calculateMonthlyInterest(){ float principalAmount; @@ -123,8 +142,8 @@ void initiateCalculator(){ } } -// int main(){ +int main(){ -// initiateCalculator(); + initiateCalculator(); -// } +} diff --git a/src/interestCalculator.h b/src/interestCalculator.h index 9dfb731..0c9c3b9 100644 --- a/src/interestCalculator.h +++ b/src/interestCalculator.h @@ -5,6 +5,7 @@ void calculateYearlyInterest(); void calculateMonthlyInterest(); +void askForSavingGoal(float principalAmount, float accInterestPerYear); float initiateInterest(float principalAmount, float interest, float time); void troubleshoot(int errorCode); #endif \ No newline at end of file From 8ef7a2647f1a5079d9ee3f1bfa99402935bed09b Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 15:16:21 +0100 Subject: [PATCH 4/9] Prevent unlogical calculations --- src/interestCalculator.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/interestCalculator.c b/src/interestCalculator.c index 0764a39..58c1072 100644 --- a/src/interestCalculator.c +++ b/src/interestCalculator.c @@ -17,6 +17,9 @@ void troubleshoot(int errorCode){ case 3: printf("Invalid option. Aborting."); break; + case 4: + printf("Your goal cannot be smaller than your principal funds. Aborting."); + break; } } @@ -24,16 +27,21 @@ void askForSavingGoal(float principalAmount, float accInterestPerYear){ char c; float goal; float timeForGoal; - printf("\nWould you like to set a saving goal?"); + printf("\nWould you like to set a saving goal? [y] yes [any] no"); scanf(" %c",&c); if(c=='y'||c=='Y'){ printf("\nPlease enter your goal amount in €:"); scanf("%f",&goal); - timeForGoal=(goal-principalAmount)/accInterestPerYear; - printf("In %.1f years you will reach your goal of %f.\n", timeForGoal, goal); + if(goal>=principalAmount){ + timeForGoal=(goal-principalAmount)/accInterestPerYear; + printf("\nIn %.1f years you will reach your goal of %f.\n", timeForGoal, goal); + }else{ + troubleshoot(4); + return; + } }else{ - //error + return; } } From be9cbd981e5ef69e0ecc842262e49e5e3ee610ec Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 15:34:10 +0100 Subject: [PATCH 5/9] Create displayDisclaimer function --- src/displayDisclaimer.c | 20 ++++++++++++++++++++ src/displayDisclaimer.h | 7 +++++++ src/interestCalculator.c | 6 +++--- tests/test_updateCustomerAccountBalance.c | 9 +++++++++ 4 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/displayDisclaimer.c create mode 100644 src/displayDisclaimer.h diff --git a/src/displayDisclaimer.c b/src/displayDisclaimer.c new file mode 100644 index 0000000..a324e93 --- /dev/null +++ b/src/displayDisclaimer.c @@ -0,0 +1,20 @@ +#include "displayDisclaimer.h" + +void displayDisclaimer(){ + printf(" W E L C O M E T O \n"); + printf(" .______ .___ ___. _______.\n"); + printf(" | _ \\ | \\/ | / |\n"); + printf(" | |_) | | \\ / | | (----`\n"); + printf(" | _ < | |\\/| | \\ \\ \n"); + printf(" | |_) | | | | | .----) | \n"); + printf(" |______/ |__| |__| |_______/ \n"); + printf(" \n"); + printf("B A N K M A N A G E M E N T S Y S T E M\n"); + printf(":.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:\n"); + printf("Created by Atharva, Can, Haytham, Julius, Shivam, and Yahya for AI1001.\n"); +} + +// int main(){ +// displayDisclaimer(); +// return 1; +// } \ No newline at end of file diff --git a/src/displayDisclaimer.h b/src/displayDisclaimer.h new file mode 100644 index 0000000..7043974 --- /dev/null +++ b/src/displayDisclaimer.h @@ -0,0 +1,7 @@ +#ifndef DISPLAYDISCLAIMER_H_ +#define DISPLAYDISCLAIMER_H_ +#include + +void displayDisclaimer(); + +#endif \ No newline at end of file diff --git a/src/interestCalculator.c b/src/interestCalculator.c index 58c1072..b2e5462 100644 --- a/src/interestCalculator.c +++ b/src/interestCalculator.c @@ -150,8 +150,8 @@ void initiateCalculator(){ } } -int main(){ +// int main(){ - initiateCalculator(); +// initiateCalculator(); -} +// } diff --git a/tests/test_updateCustomerAccountBalance.c b/tests/test_updateCustomerAccountBalance.c index 5b5454b..833c9fc 100644 --- a/tests/test_updateCustomerAccountBalance.c +++ b/tests/test_updateCustomerAccountBalance.c @@ -54,5 +54,14 @@ void test_updateAvailableAccountBalanceSuccess(void){ TEST_ASSERT_TRUE(result[i]); } +} +void test_failOpenFile(void) { + + /* Act and assert */ + + FILE *file = fopen("false_file_name", "r"); + + TEST_ASSERT_FALSE(file); + } #endif From 28b1b195cb137338fa27129a719c7e8ae7ab028f Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 15:41:34 +0100 Subject: [PATCH 6/9] Refactoring: optimize saving request --- src/interestCalculator.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/interestCalculator.c b/src/interestCalculator.c index b2e5462..a458947 100644 --- a/src/interestCalculator.c +++ b/src/interestCalculator.c @@ -23,29 +23,31 @@ void troubleshoot(int errorCode){ } } -void askForSavingGoal(float principalAmount, float accInterestPerYear){ +void askForSavingGoal(float principalAmount, float accInterestPerYear) { char c; float goal; float timeForGoal; - printf("\nWould you like to set a saving goal? [y] yes [any] no"); - scanf(" %c",&c); - - if(c=='y'||c=='Y'){ - printf("\nPlease enter your goal amount in €:"); - scanf("%f",&goal); - if(goal>=principalAmount){ - timeForGoal=(goal-principalAmount)/accInterestPerYear; - printf("\nIn %.1f years you will reach your goal of %f.\n", timeForGoal, goal); - }else{ - troubleshoot(4); - return; - } - }else{ + + printf("\nWould you like to set a saving goal? [y/n]: "); + scanf(" %c", &c); + + if (c != 'y' && c != 'Y') { + return; + } + + printf("\nPlease enter your goal amount in €: "); + scanf("%f", &goal); + + if (goal < principalAmount) { + troubleshoot(4); return; } + timeForGoal = (goal - principalAmount) / accInterestPerYear; + printf("\nIn %.1f years you will reach your goal of %.2f.\n", timeForGoal, goal); } + float initiateInterest(float principalAmount, float interest, float time){ return principalAmount*(1+(interest*time)); } From 3f1431da7ce3993ec04aeee12a6d5e38da635531 Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 15:43:49 +0100 Subject: [PATCH 7/9] Refactoring: optimize initiateCalculator --- src/interestCalculator.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/interestCalculator.c b/src/interestCalculator.c index a458947..9964047 100644 --- a/src/interestCalculator.c +++ b/src/interestCalculator.c @@ -126,32 +126,35 @@ void calculateMonthlyInterest(){ printf("\nAmount with the interest is %.2f€.",result); } -void initiateCalculator(){ - +void initiateCalculator() { int input; char c; - printf("Welcome to the interest calculator. Please select an option:\n[1]Calculate yearly interest\n[2]Calculate monthly interest\n"); + + printf("Welcome to the interest calculator. Please select an option:\n" + "[1] Calculate yearly interest\n" + "[2] Calculate monthly interest\n"); scanf("%d", &input); - switch(input){ + switch (input) { case 1: - calculateYearlyInterest(); - break; + calculateYearlyInterest(); + break; case 2: - calculateMonthlyInterest(); - break; + calculateMonthlyInterest(); + break; default: - break; + break; } - printf("\nThank you for using our services. Would you like to do another calculation? [y]Yes [any]No\n"); + + printf("\nThank you for using our services. Would you like to do another calculation? [y/n]: "); scanf(" %c", &c); - if(c=='y'||c=='Y'){ + + if (c == 'y' || c == 'Y') { initiateCalculator(); - }else{ - return; } } + // int main(){ // initiateCalculator(); From 4fb75efbbce265614bca742b311d4cb6436a0fbc Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 16:00:54 +0100 Subject: [PATCH 8/9] Hotfix: resolve file name problem (1/2) GitLab won't detect the difference between sendMoney.c and sendmoney.c. In order to fix it fast, this commit will remove the files, and then add new ones in the next push. --- src/sendmoney.c | 121 ------------------------------------------------ src/sendmoney.h | 14 ------ 2 files changed, 135 deletions(-) delete mode 100644 src/sendmoney.c delete mode 100644 src/sendmoney.h 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 From cf87508c6b0ca8f5a32b93fd0f182b1c1fa93026 Mon Sep 17 00:00:00 2001 From: fdlt3817 Date: Fri, 10 Feb 2023 16:55:19 +0100 Subject: [PATCH 9/9] Hotfix: resolve file name problem (2/2) --- src/currentCustomerAccountBalance.h | 4 +- src/depositMoney.c | 4 +- src/sendMoney.c | 125 ++++++++++++++++++++++++++++ src/sendMoney.h | 14 ++++ src/updateCustomerAccountBalance.h | 4 +- src/withdrawMoney.c | 8 +- 6 files changed, 149 insertions(+), 10 deletions(-) create mode 100644 src/sendMoney.c create mode 100644 src/sendMoney.h diff --git a/src/currentCustomerAccountBalance.h b/src/currentCustomerAccountBalance.h index dc39493..36bb66e 100644 --- a/src/currentCustomerAccountBalance.h +++ b/src/currentCustomerAccountBalance.h @@ -1,5 +1,5 @@ -#ifndef CURRENTCUSTOMERACCOUNTBALANCE_H_ -#define CURRENTCUSTOMERACCOUNTBALANCE_H_ +#ifndef CurrentCustomerAccountBalance_H +#define CurrentCustomerAccountBalance_H #include diff --git a/src/depositMoney.c b/src/depositMoney.c index 33a4e2d..5732f7e 100644 --- a/src/depositMoney.c +++ b/src/depositMoney.c @@ -1,6 +1,6 @@ #include "depositMoney.h" -#include "updateCustomerAccountBalance.c" -#include "currentCustomerAccountBalance.c" +#include "updateCustomerAccountBalance.h" +#include "currentCustomerAccountBalance.h" void askToTryAgain(bool afterError, int customerID){ char choice; diff --git a/src/sendMoney.c b/src/sendMoney.c new file mode 100644 index 0000000..f597ac8 --- /dev/null +++ b/src/sendMoney.c @@ -0,0 +1,125 @@ +#include "sendMoney.h" +#include "depositMoney.h" +#include "withdrawMoney.h" +#include "currencyExchange.h" +#include "currentCustomerAccountBalance.h" +#include "updateCustomerAccountBalance.h" + + + +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 new file mode 100644 index 0000000..df64387 --- /dev/null +++ b/src/sendMoney.h @@ -0,0 +1,14 @@ +#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 diff --git a/src/updateCustomerAccountBalance.h b/src/updateCustomerAccountBalance.h index 17f34ae..5b056f4 100644 --- a/src/updateCustomerAccountBalance.h +++ b/src/updateCustomerAccountBalance.h @@ -1,5 +1,5 @@ -#ifndef UPDATECUSTOMERACCOUNTBALANCE_H_ -#define UPDATECUSTOMERACCOUNTBALANCE_H_ +#ifndef UpdateCustomerAccountBalance_H +#define UpdateCustomerAccountBalance_H #include #include diff --git a/src/withdrawMoney.c b/src/withdrawMoney.c index 4bd3eaf..65e23b2 100644 --- a/src/withdrawMoney.c +++ b/src/withdrawMoney.c @@ -1,6 +1,7 @@ #include "withdrawMoney.h" -#include "updateCustomerAccountBalance.c" -#include "currentCustomerAccountBalance.c" +#include "updateCustomerAccountBalance.h" +#include "currentCustomerAccountBalance.h" + void notifyCustomer(float amountToWithdraw, float remainingAccountBalance, int user_id) { char c; @@ -51,12 +52,11 @@ bool withdraw(int user_id) { updateSuccess = updateAvailableAccountBalance(user_id, remainingAccountBalance); if( updateSuccess ) { notifyCustomer(amountToWithdraw, remainingAccountBalance, user_id); - return true; } else { printf("Some error occured! Sorry for the inconvenience caused.\n"); - return false; } + return updateSuccess; } else {