Browse Source

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.

remotes/origin/development
fdai7057 2 years ago
parent
commit
afa674f8d2
  1. 22
      src/customerMenu.c
  2. 2
      src/customerMenu.h
  3. 5
      src_2/CustomerProperties.h

22
src_2/CustomerMenu.c → src/customerMenu.c

@ -1,26 +1,26 @@
#include "CustomerMenu.h"
#include "customerMenu.h"
void customerChoiceForMenuItem(int numberOfMenuItem) void customerChoiceForMenuItem(int numberOfMenuItem)
{ {
switch(numberOfMenuItem){ switch(numberOfMenuItem){
case 1: case 1:
printf("You have chosen to send money.\n");
puts("You have chosen to send money.\n");
//call sendMoney(); //call sendMoney();
break; break;
case 2: case 2:
printf("You have chosen to withdraw money.\n");
puts("You have chosen to withdraw money.\n");
//call withDrawMoney(); //call withDrawMoney();
break; break;
case 3: case 3:
printf("You have chosen to deposit money.\n");
puts("You have chosen to deposit money.\n");
//call depositMoney(); //call depositMoney();
break; break;
case 4: case 4:
printf("You have chosen to request a loan.\n");
puts("You have chosen to request a loan.\n");
//call requestLoan(); //call requestLoan();
break; break;
default: default:
printf("Invalid input.\n",numberOfMenuItem);
puts("Invalid input.\n");
} }
} }
@ -33,19 +33,19 @@ void showAllMenuEntries()
puts("CUSTOMER MENU"); puts("CUSTOMER MENU");
puts("\n"); puts("\n");
printf("Select between (1-4):");
puts("Select between (1-4):");
puts("\n\n\n"); puts("\n\n\n");
printf("->->->1. send money<-<-<-");
puts("->->->1. send money<-<-<-");
puts("\n\n\n"); puts("\n\n\n");
printf("->->->2. withdraw money<-<-<-");
puts("->->->2. withdraw money<-<-<-");
puts("\n\n\n"); puts("\n\n\n");
printf("->->->3. deposit money<-<-<-");
puts("->->->3. deposit money<-<-<-");
puts("\n\n\n"); puts("\n\n\n");
printf("->->->4. request loan<-<-<-");
puts("->->->4. request loan<-<-<-");
puts("\n\n\n"); puts("\n\n\n");
puts("Your decision: "); puts("Your decision: ");

2
src_2/CustomerMenu.h → src/customerMenu.h

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "CustomerProperties.h"
#include "customerProperties.h"
void customerChoiceForMenuItem(int); void customerChoiceForMenuItem(int);
void showAllMenuEntries(); void showAllMenuEntries();
void menu(customer_t *); void menu(customer_t *);

5
src_2/CustomerProperties.h

@ -1,5 +0,0 @@
typedef struct Customer
{
char *ID,*forename, *surname,*password;
float balance;
}customer_t;
Loading…
Cancel
Save