Website Summary Files Commits Branches @commit @diff @stats
path: root / Week09 / Exercise01 / Locomotive.h
blob: 45e9f7b5ffa8a5946c01ab7d53f1a9d5a574f31a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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 */