Question
Reference - https://github.com/Seneca-244200/OOP-Project#milestone-3 Files to this answer- Publication.h Publication.cpp Publication class module The publication class is a general encapsulation of any periodic publication. Later by
Reference - https://github.com/Seneca-244200/OOP-Project#milestone-3
Files to this answer-
Publication.h
Publication.cpp
Publication class module
The publication class is a general encapsulation of any periodic publication.
Later by adding an author to the descendant of the Publication class we will encapsulate a Book for the system.
Publication Attributes
1. m_title
m_title is a c-string to hold a dynamic title for the publication.
To ease the implementation, let's assume this dynamic array can not be more than 255 characters long.
This attribute is null by default.
2. m_shelfId
Hold the location of the publication in the library. m_shelfId is a c-string that is exactly 4 characters long.
This attribute is an empty string by default.
3.m_membership
This attribute is an integer to hold a 5 digit membership number of members of the library.
In this class, if the membership number is '0', it means the publication is available and is not checked out by any members.
If the membership number is a five-digit number, it means the publication is checked out by the member holding that membership number.
This attribute is zero by default.
4.m_libRef
This serial number is used internally to uniquely identify each publication in the system.
This attribute is -1 by default.
5. m_date
A Date object.
In periodical publications, this date is used for the publish date of the item.
In Books, this date is used to keep the date on which the book was borrowed by the member.
The Date, by default, is set to the current date.
Constructor (default)
Sets all the attributes to their default values.
Methods
Modifiers
virtual void set(int member_id); // Sets the membership attribute to either zero or a five-digit integer. void setRef(int value); // Sets the **libRef** attribute value void resetDate(); // Sets the date to the current date of the system.
Queries
virtual char type()const; //Returns the character 'P' to identify this object as a "Publication object" bool onLoan()const; //Returns true is the publication is checkout (membership is non-zero) Date checkoutDate()const; //Returns the date attribute bool operator==(const char* title)const; //Returns true if the argument title appears anywhere in the title of the //publication. Otherwise, it returns false; (use strstr() function in ) operator const char* ()const; //Returns the title attribute int getRef()const; //Returns the libRef attirbute.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started