Website Summary Files Commits Branches @commit @diff @stats
path: root / Week08 / Exercise01 / Rocket.h
diff options
context:
space:
mode:
Commit7d98b664c9e459a08f2e6e6fa5b636686dfed554 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-04-08 10:42:51 +0300
Committer
 Syndamia <kamen@syndamia.com>
2026-04-08 10:42:51 +0300
Filesb2b6eddb0c6f582999ebb32c8dea2a01b477d747 /Week08/Exercise01/Rocket.h
oop-2025-solutions-7d98b664c9e459a08f2e6e6fa5b636686dfed554.tar
oop-2025-solutions-7d98b664c9e459a08f2e6e6fa5b636686dfed554.tar.gz
oop-2025-solutions-7d98b664c9e459a08f2e6e6fa5b636686dfed554.zip
Parent945f7e67d6ca8047c961457786fac5e2d9a13d82 (diff)
feat(Week08): Add solutions
1 files changed, 39 insertions, 0 deletions
-rw-r--r--Week08/Exercise01/Rocket.h39
diff --git a/Week08/Exercise01/Rocket.h b/Week08/Exercise01/Rocket.h
new file mode 100644
index 0000000..90ab2c7
--- /dev/null
+++ b/Week08/Exercise01/Rocket.h
@@ -0,0 +1,39 @@
+#ifndef _ROCKET
+#define _ROCKET
+
+#include "RocketStage.h"
+#include <fstream>
+
+class Rocket {
+ char name[512];
+ RocketStage* stages;
+ unsigned stagesCount;
+ unsigned stagesAlloc;
+
+ void free();
+ void copyFrom(const Rocket& other);
+
+ void resize();
+
+public:
+ Rocket();
+ ~Rocket();
+ Rocket(const Rocket& other);
+ Rocket& operator=(const Rocket& other);
+ Rocket(Rocket&& other);
+ Rocket& operator=(Rocket&& other);
+
+ void SetName(const char* name);
+ void AddStage(const RocketStage& stage);
+
+ double TotalWeight() const;
+ unsigned TotalHeight() const;
+ double FinalStageSpeed() const;
+ double TotalDistanceTravel() const;
+ unsigned TotalBurnTime() const;
+
+ void Export(std::ofstream& outFile) const;
+ void Import(std::ifstream& inFile);
+};
+
+#endif /* _ROCKET */