diff --git a/Homework2/src/compute_arithmetic.cc b/Homework2/src/compute_arithmetic.cc index 7d42e9a..04d20bf 100644 --- a/Homework2/src/compute_arithmetic.cc +++ b/Homework2/src/compute_arithmetic.cc @@ -1,40 +1,21 @@ #include "compute_arithmetic.hh" compute_arithmetic::compute_arithmetic() { - std::cout<<"compute_arithmetic object constructed!"< -#include - -class Series +Series::Series() { -public: - // Constructor - Destructor - Series() - { - std::cout<<"Series object constructed!"<current_index) + { + current_index += 1; + current_value += expression(current_index); + } + else { - if (N>current_index) - { - current_index += 1; - current_value += expression(current_index); - } - else - { - current_value -= expression(current_index); - current_index -= 1; - } + current_value -= expression(current_index); + current_index -= 1; } - return current_value; } -}; + return current_value; +} -#endif \ No newline at end of file +double Series::getAnalyticPrediction() +{ + return std::nan(""); +} \ No newline at end of file diff --git a/Homework2/src/series.hh b/Homework2/src/series.hh index fa25e8c..c53b192 100644 --- a/Homework2/src/series.hh +++ b/Homework2/src/series.hh @@ -1,55 +1,26 @@ #ifndef SERIES_HH #define SERIES_HH #include #include class Series { public: // Constructor - Destructor - Series() - { - std::cout<<"Series object constructed!"<current_index) - { - current_index += 1; - current_value += expression(current_index); - } - else - { - current_value -= expression(current_index); - current_index -= 1; - } - } - return current_value; - } + // Members + unsigned int current_index; // Upper bound of the last summation + double current_value; // Value of the last summation }; #endif \ No newline at end of file