Library Management
Loading...
Searching...
No Matches
Book.h
1#ifndef LIBRARYMANAGEMENT_BOOK_H
2#define LIBRARYMANAGEMENT_BOOK_H
3
4#include <string>
5
6using namespace std;
7
16class Book {
17public:
22 Book();
23
35 Book(string title, string author, string genre, short publicationYear, long long isbn,
36 bool isAvailable);
37
43 [[nodiscard]] const string &getTitle() const;
44
50 void setTitle(const string &title);
51
57 [[nodiscard]] const string &getAuthor() const;
58
64 void setAuthor(const string &author);
65
71 [[nodiscard]] const string &getGenre() const;
72
78 void setGenre(const string &genre);
79
85 [[nodiscard]] short getPublicationYear() const;
86
93
99 [[nodiscard]] long long getIsbn() const;
100
106 void setIsbn(long long isbn);
107
113 [[nodiscard]] bool isAvailable() const;
114
120 void setIsAvailable(bool isAvailable);
121
128 bool operator<(const Book &b) const;
129
136 bool operator==(const Book &b) const;
137
143 [[nodiscard]] string getInfo() const;
144
150 [[nodiscard]] int getFine() const;
151
157 void setFine(int fine);
158
164 [[nodiscard]] int getDaysCheckedOut() const;
165
172
173private:
174 string title;
175 string author;
176 string genre;
178 long long ISBN;
180 int fine;
182};
183
184#endif //LIBRARYMANAGEMENT_BOOK_H
Represents a book in the library management system.
Definition Book.h:16
long long ISBN
The ISBN of the book.
Definition Book.h:178
void setDaysCheckedOut(int daysCheckedOut)
Set the number of days the book has been checked out.
Definition Book.cpp:212
int fine
The fine associated with the book.
Definition Book.h:180
void setGenre(const string &genre)
Set the genre of the book.
Definition Book.cpp:86
bool available
Availability status of the book.
Definition Book.h:179
Book()
Default constructor for the Book class. Initializes a book with default values.
Definition Book.cpp:10
const string & getTitle() const
Get the title of the book.
Definition Book.cpp:41
void setAuthor(const string &author)
Set the author of the book.
Definition Book.cpp:68
long long getIsbn() const
Get the ISBN of the book.
Definition Book.cpp:113
void setPublicationYear(short publicationYear)
Set the publication year of the book.
Definition Book.cpp:104
bool operator<(const Book &b) const
Compare two books based on their ISBN.
Definition Book.cpp:150
int getFine() const
Get the fine associated with the book.
Definition Book.cpp:185
string title
The title of the book.
Definition Book.h:174
void setFine(int fine)
Set the fine associated with the book.
Definition Book.cpp:194
string genre
The genre of the book.
Definition Book.h:176
string author
The author of the book.
Definition Book.h:175
short publicationYear
The year the book was published.
Definition Book.h:177
short getPublicationYear() const
Get the publication year of the book.
Definition Book.cpp:95
string getInfo() const
Get detailed information about the book.
Definition Book.cpp:169
void setIsbn(long long isbn)
Set the ISBN of the book.
Definition Book.cpp:122
const string & getAuthor() const
Get the author of the book.
Definition Book.cpp:59
void setTitle(const string &title)
Set the title of the book.
Definition Book.cpp:50
bool operator==(const Book &b) const
Compare two books for equality based on their ISBN.
Definition Book.cpp:160
const string & getGenre() const
Get the genre of the book.
Definition Book.cpp:77
int daysCheckedOut
The number of days the book has been checked out.
Definition Book.h:181
bool isAvailable() const
Check if the book is available.
Definition Book.cpp:131
int getDaysCheckedOut() const
Get the number of days the book has been checked out.
Definition Book.cpp:203
void setIsAvailable(bool isAvailable)
Set the availability of the book.
Definition Book.cpp:140