Skip to content

Commit

Permalink
Update inputReader.h
Browse files Browse the repository at this point in the history
  • Loading branch information
lyndskg authored Jan 7, 2024
1 parent f519a7e commit 7623d13
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions include/black-scholes-cpp/inputReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,42 @@ using namespace std;

class blackScholesModel; // Forward declaration of blackScholesModel class

// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------------
// "inputReader" Class Declarations
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------------

class inputReader {
private:
double underlyingPrice;
/*------------------------ HELPER FUNCTION VARIABLES ---------------------------*/

/*--------------------------- HELPER FUNCTION VARIABLES -----------------------------*/

string input;
bool validInput;
int i;

public:
/*-------------------------------- CONSTRUCTORS ---------------------------------*/
/*---------------------------------- CONSTRUCTORS ----------------------------------*/

// Default constructor.
inputReader();


/*------------------------ KEY MEMBER FUNCTIONS -----------------------------*/
/*--------------------------- KEY MEMBER FUNCTIONS ----------------------------------*/

// Reads input values from the user interactively.
//

// Time complexity: O(1) per input prompt
// i.e. time complexity depends on the number of input prompts
// and the time it takes for the user to provide valid input.
// Space complexity: O(1)
//

// TODO: Use validateAndSetInputValues()?
bool readInputFromUser(blackScholesModel& model);


// Reads input parameters from a file (e.g. JSON or CSV).
//

// Time complexity: O(1) per input read from the file
// Space complexity: O(1)
void readInputFromFile(blackScholesModel& model, const string& filename);
Expand All @@ -60,7 +62,7 @@ class inputReader {
/* Reads input values from a database.
It connects to the database, retrieves the input data, validates the
retrieved values, and sets them in the blackScholesModel object. */
//

// Time complexity: O(1) [per input retrieval from the database]
// Space complexity: O(1)
//
Expand All @@ -73,16 +75,16 @@ class inputReader {
and performs the request. The received response is stored in the 'response' string
and then parsed to extract the input values. Finally, the retrieved input values
are validated and set in the blackScholesModel object. */
//

// Time complexity: O(1) [per input retrieval from the API]
// Space complexity: O(1)
//

// TODO: IMPLEMENT
void readInputFromAPI(blackScholesModel& model);


// Validates and sets the input values for the blackScholesModel.
//

// Time complexity: O(1)
// Space complexity: O(1)
bool validateAndSetInputValues(blackScholesModel& model, double underlyingPrice,
Expand Down

0 comments on commit 7623d13

Please sign in to comment.