Website Summary Files Commits Branches @commit @diff @stats
path: root / Week09 / Exercise01 / Locomotive.h
diff options
context:
space:
mode:
Commitb38346eebca9a007971af02fb3bb9472c5e16d0c (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-04-26 21:43:31 +0300
Committer
 Syndamia <kamen@syndamia.com>
2026-04-26 21:43:31 +0300
Files575a64089a17be271aec84683f426252d8f5d1f9 /Week09/Exercise01/Locomotive.h
oop-2025-solutions-b38346eebca9a007971af02fb3bb9472c5e16d0c.tar
oop-2025-solutions-b38346eebca9a007971af02fb3bb9472c5e16d0c.tar.gz
oop-2025-solutions-b38346eebca9a007971af02fb3bb9472c5e16d0c.zip
Parent7d98b664c9e459a08f2e6e6fa5b636686dfed554 (diff)
feat(Week09): Add solutions
1 files changed, 43 insertions, 0 deletions
-rw-r--r--Week09/Exercise01/Locomotive.h43
diff --git a/Week09/Exercise01/Locomotive.h b/Week09/Exercise01/Locomotive.h
new file mode 100644
index 0000000..45e9f7b
--- /dev/null
+++ b/Week09/Exercise01/Locomotive.h
@@ -0,0 +1,43 @@
+#ifndef _LOCOMOTIVE
+#define _LOCOMOTIVE
+
+#include <fstream>
+
+const unsigned MAX_LEN = 1024;
+
+class Locomotive {
+ unsigned ID;
+ char manufacturer[MAX_LEN];
+ char model[MAX_LEN];
+ int yearOfManufacture;
+ double length;
+ unsigned short cyllinders;
+ bool supportsMultipleWorking;
+
+public:
+ unsigned GetID() const;
+ void SetID(unsigned ID);
+
+ const char* GetManufacturer() const;
+ void SetManufacturer(const char manufacturer[MAX_LEN]);
+
+ const char* GetModel() const;
+ void SetModel(const char model[MAX_LEN]);
+
+ int GetYearOfManufacture() const;
+ void SetYearOfManufacture(int yearOfManufacture);
+
+ double GetLength() const;
+ void SetLength(double length);
+
+ unsigned short GetCyllinders() const;
+ void SetCyllinders(unsigned short cyllinders);
+
+ bool GetSupportsMultipleWorking() const;
+ void SetSupportsMultipleWorking(bool supportsMultipleWorking);
+
+ friend std::ofstream& operator<<(std::ofstream& ostr, const Locomotive& loc);
+ friend std::ifstream& operator>>(std::ifstream& istr, Locomotive& loc);
+};
+
+#endif /* _LOCOMOTIVE */