From ec11d3d7c947f6b81f9bd20806ef4223aeac4e70 Mon Sep 17 00:00:00 2001 From: fdai7514 Date: Mon, 30 Jan 2023 16:04:26 +0100 Subject: [PATCH] refactoring: implement new variables and comments in requestLoan.c and requestLoan.h --- src/requestLoan.c | 21 +++++++++------------ src/requestLoan.h | 7 ++++++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/requestLoan.c b/src/requestLoan.c index b639585..dc396ec 100644 --- a/src/requestLoan.c +++ b/src/requestLoan.c @@ -1,27 +1,24 @@ #include "requestLoan.h" -int allow() + +int allow() //int allow() is helpful for indirectly testing void requestLoan() { if (a == 1) { return 1; } - else - { - return 0; - } } 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(" \n"); - printf(" \n"); - printf(" 1000 Euro\n"); - printf(" 2500 Euro\n"); - printf(" 5000 Euro\n"); + printf(" Please select a loan Package: \n"); + printf(" \n"); + printf(" \n"); + printf(" %d %s\n", option1, currency); + printf(" %d %s\n", option2, currency); + printf(" %d %s\n", option3, currency); } } diff --git a/src/requestLoan.h b/src/requestLoan.h index de31f48..25c0001 100644 --- a/src/requestLoan.h +++ b/src/requestLoan.h @@ -3,8 +3,13 @@ #include #include + void requestLoan(); 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