Website Summary Files Commits Branches @commit @diff @stats
path: root / Week09 / Exercise01 / Locomotive.h
diff options
context:
space:
mode:
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 */