diff --git a/Hw1/task3.cpp b/Hw1/task3.cpp new file mode 100644 index 0000000..60d2f53 --- /dev/null +++ b/Hw1/task3.cpp @@ -0,0 +1,50 @@ +#include +#include +#include + +using namespace std; + +// TODO: finish implementation +class Hop { +private: + double maxheight, startVelocity, startTime; + bool isHalfed; + const double loss = 0.7; + const double g = 10; + +public: + Hop(double initHeight, bool starter); + ~Hop(); + double hopTime(); + double getPosition(double time); + double getVelocity(double time); +}; + +Hop::Hop(double initHeight, bool starter) +{ + maxheight = initHeight; + isHalfed = starter; + startTime = 0; + startVelocity = 0; +} + +double Hop::hopTime() +{ + if (isHalfed) + return sqrt((2 * maxheight) / g); + return 2 * sqrt((2 * maxheight) / g); +} + +double Hop::getPosition(double time) +{ + return time * startVelocity - g * time * time / 2; +} + +Hop::~Hop() +{ +} + +int main() +{ + return 0; +} \ No newline at end of file