From 6edec343d69e7097af314a141349b0edce3df488 Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Sat, 21 Jan 2023 19:48:43 +0100 Subject: [PATCH 1/4] Implementation of function customerChoiceForMenuItem() --- build-project.sh | 5 ----- src/CustomerMenu.c | 25 +++++++++++++++++++++++++ src/CustomerMenu.h | 2 ++ src/main.c | 7 ------- team.md | 9 --------- 5 files changed, 27 insertions(+), 21 deletions(-) delete mode 100755 build-project.sh create mode 100644 src/CustomerMenu.c create mode 100644 src/CustomerMenu.h delete mode 100644 src/main.c delete mode 100644 team.md diff --git a/build-project.sh b/build-project.sh deleted file mode 100755 index fbd6ce9..0000000 --- a/build-project.sh +++ /dev/null @@ -1,5 +0,0 @@ -clear -cd src/ -gcc main.c -./a.out -rm a.out diff --git a/src/CustomerMenu.c b/src/CustomerMenu.c new file mode 100644 index 0000000..423bec6 --- /dev/null +++ b/src/CustomerMenu.c @@ -0,0 +1,25 @@ +#include "CustomerMenu.h" + +void customerChoiceForMenuItem(int numberOfMenuItem) +{ + switch(numberOfMenuItem){ + case 1: + printf("You have choosen to send money.\n"); + //call sendMoney(); + break; + case 2: + printf("You have choosen to withdraw money.\n"); + //call withDrawMoney(); + break; + case 3: + printf("You have choosen to deposit money.\n"); + //call depositMoney(); + break; + case 4: + printf("You have choosen to request a loan.\n"); + //call requestLoan(); + break; + default: + printf("No item for number %d.\n",numberOfMenuItem); + } +} diff --git a/src/CustomerMenu.h b/src/CustomerMenu.h new file mode 100644 index 0000000..fd3110b --- /dev/null +++ b/src/CustomerMenu.h @@ -0,0 +1,2 @@ +#include +void customerChoiceForMenuItem(int); diff --git a/src/main.c b/src/main.c deleted file mode 100644 index 2e0147f..0000000 --- a/src/main.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main() -{ - - return 0; -} diff --git a/team.md b/team.md deleted file mode 100644 index 02580e9..0000000 --- a/team.md +++ /dev/null @@ -1,9 +0,0 @@ -# Bankmanagement-System - -- Can Hacioglu, Fdlt3817 -- Atharva Kishor Naik, fdai7514 -- Julius Philipp Engel, fdai7057 -- Shivam Chaudhary, fdlt3781 -- Mohamed Yahya Dahi, fdai6618 -- Haytham Daoula, fdai7207 - From 3e1cc260d42779761b7edf2562701c725107a931 Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Sun, 22 Jan 2023 08:55:16 +0100 Subject: [PATCH 2/4] Implementation of function showAllMenuEntries() --- src/CustomerMenu.c | 31 ++++++++++++++++++++++++++++++- src/CustomerMenu.h | 1 + 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/CustomerMenu.c b/src/CustomerMenu.c index 423bec6..78a067a 100644 --- a/src/CustomerMenu.c +++ b/src/CustomerMenu.c @@ -20,6 +20,35 @@ void customerChoiceForMenuItem(int numberOfMenuItem) //call requestLoan(); break; default: - printf("No item for number %d.\n",numberOfMenuItem); + printf("Invalid input.\n",numberOfMenuItem); } } + +void showAllMenuEntries() +{ + + int userDecision = 0; + + puts("\n\n\n"); + puts("CUSTOMER MENU"); + + puts("\n"); + printf("Select between (1-4):"); + puts("\n\n\n"); + + printf(">->->1. send money<-<-<"); + puts("\n\n\n"); + + printf(">->->2. withdraw money<-<-<"); + puts("\n\n\n"); + + printf(">->->3. deposit money<-<-<"); + puts("\n\n\n"); + + printf(">->->4. request loan<-<-<"); + puts("\n\n\n"); + + puts("Your decision: "); + scanf("%d",&userDecision); + customerChoiceForMenuItem(userDecision); +} diff --git a/src/CustomerMenu.h b/src/CustomerMenu.h index fd3110b..5839a26 100644 --- a/src/CustomerMenu.h +++ b/src/CustomerMenu.h @@ -1,2 +1,3 @@ #include void customerChoiceForMenuItem(int); +void showAllMenuEntries(); From b4d442e4ea26d891be4ed90677f222c37fa488d9 Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Sun, 22 Jan 2023 09:29:21 +0100 Subject: [PATCH 3/4] Implementation of function menu() --- src/CustomerMenu.c | 30 +++++++++++++++++++++--------- src/CustomerMenu.h | 3 +++ src/CustomerProperties.h | 5 +++++ 3 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 src/CustomerProperties.h diff --git a/src/CustomerMenu.c b/src/CustomerMenu.c index 78a067a..a7a1c0d 100644 --- a/src/CustomerMenu.c +++ b/src/CustomerMenu.c @@ -4,19 +4,19 @@ void customerChoiceForMenuItem(int numberOfMenuItem) { switch(numberOfMenuItem){ case 1: - printf("You have choosen to send money.\n"); + printf("You have chosen to send money.\n"); //call sendMoney(); break; case 2: - printf("You have choosen to withdraw money.\n"); + printf("You have chosen to withdraw money.\n"); //call withDrawMoney(); break; case 3: - printf("You have choosen to deposit money.\n"); + printf("You have chosen to deposit money.\n"); //call depositMoney(); break; case 4: - printf("You have choosen to request a loan.\n"); + printf("You have chosen to request a loan.\n"); //call requestLoan(); break; default: @@ -29,26 +29,38 @@ void showAllMenuEntries() int userDecision = 0; - puts("\n\n\n"); + puts("\n\n"); puts("CUSTOMER MENU"); puts("\n"); printf("Select between (1-4):"); puts("\n\n\n"); - printf(">->->1. send money<-<-<"); + printf("->->->1. send money<-<-<-"); puts("\n\n\n"); - printf(">->->2. withdraw money<-<-<"); + printf("->->->2. withdraw money<-<-<-"); puts("\n\n\n"); - printf(">->->3. deposit money<-<-<"); + printf("->->->3. deposit money<-<-<-"); puts("\n\n\n"); - printf(">->->4. request loan<-<-<"); + printf("->->->4. request loan<-<-<-"); puts("\n\n\n"); puts("Your decision: "); scanf("%d",&userDecision); customerChoiceForMenuItem(userDecision); } + +void menu(customer_t *c) +{ + if(c==NULL){ + puts("Invalid pointer. Aborting.\n"); + exit(-1); + }else{ + printf("Welcome %s %s!\n",c->forename, c->surname); + printf("Balance: %.4f€\n",c->balance); + showAllMenuEntries(); + } +} diff --git a/src/CustomerMenu.h b/src/CustomerMenu.h index 5839a26..bba3414 100644 --- a/src/CustomerMenu.h +++ b/src/CustomerMenu.h @@ -1,3 +1,6 @@ #include +#include +#include "CustomerProperties.h" void customerChoiceForMenuItem(int); void showAllMenuEntries(); +void menu(customer_t *); diff --git a/src/CustomerProperties.h b/src/CustomerProperties.h new file mode 100644 index 0000000..8e3a27e --- /dev/null +++ b/src/CustomerProperties.h @@ -0,0 +1,5 @@ +typedef struct Customer +{ + char *ID,*forename, *surname,*password; + float balance; +}customer_t; From ae13e9fbd1b6026cb6dba40cdf11b10c7df58335 Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Mon, 6 Feb 2023 13:57:22 +0100 Subject: [PATCH 4/4] prepare merge from feature/customer-menu into development --- {src => src_2}/CustomerMenu.c | 0 {src => src_2}/CustomerMenu.h | 0 {src => src_2}/CustomerProperties.h | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {src => src_2}/CustomerMenu.c (100%) rename {src => src_2}/CustomerMenu.h (100%) rename {src => src_2}/CustomerProperties.h (100%) diff --git a/src/CustomerMenu.c b/src_2/CustomerMenu.c similarity index 100% rename from src/CustomerMenu.c rename to src_2/CustomerMenu.c diff --git a/src/CustomerMenu.h b/src_2/CustomerMenu.h similarity index 100% rename from src/CustomerMenu.h rename to src_2/CustomerMenu.h diff --git a/src/CustomerProperties.h b/src_2/CustomerProperties.h similarity index 100% rename from src/CustomerProperties.h rename to src_2/CustomerProperties.h