From afa674f8d20c26af2a023b9c66eaf639411a4e0f Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Mon, 6 Feb 2023 14:18:38 +0100 Subject: [PATCH] refactoring: Where possible, remove the use of printf() and use puts() instead in customerMenu.c. One advantage is that it prints the new line character automatically. --- src_2/CustomerMenu.c => src/customerMenu.c | 22 +++++++++++----------- src_2/CustomerMenu.h => src/customerMenu.h | 2 +- src_2/CustomerProperties.h | 5 ----- 3 files changed, 12 insertions(+), 17 deletions(-) rename src_2/CustomerMenu.c => src/customerMenu.c (63%) rename src_2/CustomerMenu.h => src/customerMenu.h (80%) delete mode 100644 src_2/CustomerProperties.h diff --git a/src_2/CustomerMenu.c b/src/customerMenu.c similarity index 63% rename from src_2/CustomerMenu.c rename to src/customerMenu.c index a7a1c0d..20bc709 100644 --- a/src_2/CustomerMenu.c +++ b/src/customerMenu.c @@ -1,26 +1,26 @@ -#include "CustomerMenu.h" +#include "customerMenu.h" void customerChoiceForMenuItem(int numberOfMenuItem) { switch(numberOfMenuItem){ case 1: - printf("You have chosen to send money.\n"); + puts("You have chosen to send money.\n"); //call sendMoney(); break; case 2: - printf("You have chosen to withdraw money.\n"); + puts("You have chosen to withdraw money.\n"); //call withDrawMoney(); break; case 3: - printf("You have chosen to deposit money.\n"); + puts("You have chosen to deposit money.\n"); //call depositMoney(); break; case 4: - printf("You have chosen to request a loan.\n"); + puts("You have chosen to request a loan.\n"); //call requestLoan(); break; default: - printf("Invalid input.\n",numberOfMenuItem); + puts("Invalid input.\n"); } } @@ -33,19 +33,19 @@ void showAllMenuEntries() puts("CUSTOMER MENU"); puts("\n"); - printf("Select between (1-4):"); + puts("Select between (1-4):"); puts("\n\n\n"); - printf("->->->1. send money<-<-<-"); + puts("->->->1. send money<-<-<-"); puts("\n\n\n"); - printf("->->->2. withdraw money<-<-<-"); + puts("->->->2. withdraw money<-<-<-"); puts("\n\n\n"); - printf("->->->3. deposit money<-<-<-"); + puts("->->->3. deposit money<-<-<-"); puts("\n\n\n"); - printf("->->->4. request loan<-<-<-"); + puts("->->->4. request loan<-<-<-"); puts("\n\n\n"); puts("Your decision: "); diff --git a/src_2/CustomerMenu.h b/src/customerMenu.h similarity index 80% rename from src_2/CustomerMenu.h rename to src/customerMenu.h index bba3414..dd05fd0 100644 --- a/src_2/CustomerMenu.h +++ b/src/customerMenu.h @@ -1,6 +1,6 @@ #include #include -#include "CustomerProperties.h" +#include "customerProperties.h" void customerChoiceForMenuItem(int); void showAllMenuEntries(); void menu(customer_t *); diff --git a/src_2/CustomerProperties.h b/src_2/CustomerProperties.h deleted file mode 100644 index 8e3a27e..0000000 --- a/src_2/CustomerProperties.h +++ /dev/null @@ -1,5 +0,0 @@ -typedef struct Customer -{ - char *ID,*forename, *surname,*password; - float balance; -}customer_t;