Website Summary Files Commits Branches @commit @diff @stats
path: root / Utills / Kindle / Book.h
diff options
context:
space:
mode:
Commit414aec98b546d11698af7fdcb441e8080da6e46a (patch)
Author
 Stoycho Kyosev <68247567+stoychoX@users.noreply.github.com>
2022-05-12 22:21:57 +0300
Committer
 GitHub <noreply@github.com>
2022-05-12 22:21:57 +0300
Filesb8747c23acce8a9c91ad3364f7bd020cc3aa204e /Utills/Kindle/Book.h
Object-oriented_programming_FMI-414aec98b546d11698af7fdcb441e8080da6e46a.tar
Object-oriented_programming_FMI-414aec98b546d11698af7fdcb441e8080da6e46a.tar.gz
Object-oriented_programming_FMI-414aec98b546d11698af7fdcb441e8080da6e46a.zip
Parentfdf22bff479c48991ea769ffe3964d50678c5ffb (diff)
Add files via upload
1 files changed, 34 insertions, 0 deletions
-rw-r--r--Utills/Kindle/Book.h34
diff --git a/Utills/Kindle/Book.h b/Utills/Kindle/Book.h
new file mode 100644
index 0000000..29c4f13
--- /dev/null
+++ b/Utills/Kindle/Book.h
@@ -0,0 +1,34 @@
+#pragma once
+#include"vector.hpp"
+#include"Page.h"
+#include"Pair.hpp"
+#include"serialize.h"
+
+class Book {
+private:
+ string author;
+ string title;
+ Vector<Pair<string, unsigned>> ratings; // User name + rate
+ Vector<Page> data; // Pages
+ Vector<Pair<string, string>> comments; // commenter's name + comment
+
+ void addRating(unsigned short r, const string& name);
+
+ void write(unsigned pagesCount);
+ void displayBook() const;
+
+ void showComments() const;
+ void showRates() const;
+ void print() const;
+ void displayHelpMenu() const;
+public:
+ Book() {}
+ Book(const string& author, const string& title);
+
+ void writeToFile(std::ofstream& outFile) const;
+ void readFromFile(std::ifstream& inFile);
+ double getAvarageRating() const;
+
+ friend class Kindle;
+};
+