Browse Source

refactoring: implement new variables and comments in requestLoan.c and requestLoan.h

remotes/origin/feature/request-loan
fdai7514 2 years ago
parent
commit
ec11d3d7c9
  1. 15
      src/requestLoan.c
  2. 7
      src/requestLoan.h

15
src/requestLoan.c

@ -1,27 +1,24 @@
#include "requestLoan.h" #include "requestLoan.h"
int allow()
int allow() //int allow() is helpful for indirectly testing void requestLoan()
{ {
if (a == 1) if (a == 1)
{ {
return 1; return 1;
} }
else
{
return 0;
}
} }
void requestLoan() void requestLoan()
{ {
if (allow() == 1)
if (allow() == 1) //only if int allow() returns 1, void requestLoan() will display the desired output
{ {
printf(" Please select a loan Package: \n"); printf(" Please select a loan Package: \n");
printf(" \n"); printf(" \n");
printf(" \n"); printf(" \n");
printf(" 1000 Euro\n");
printf(" 2500 Euro\n");
printf(" 5000 Euro\n");
printf(" %d %s\n", option1, currency);
printf(" %d %s\n", option2, currency);
printf(" %d %s\n", option3, currency);
} }
} }

7
src/requestLoan.h

@ -3,8 +3,13 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
void requestLoan(); void requestLoan();
int allow(); int allow();
const int a = 1;
const int a = 1; //a is a constant used for indirectly testing void requestLoan()
char currency[] = "Euro";
int option1 = 1000;
int option2 = 2500;
int option3 = 5000;
#endif // REQUESTLOAN_H #endif // REQUESTLOAN_H
Loading…
Cancel
Save