Introduction
This lab gives you the opportunity to explore object-oriented programming It asks you to construct a few classes, use sub-types and inheritence, and pass messages. It is a design exercise in that it gives you the requirements -- and you have to design the classes and their features to satisfy them.
Requirements
This lab asks you to model Publications, specifically Periodicals and Books in Python. As you might imagine, Periodicals and Books, as types of Publications have much in common -- but also have certain unique properties. You should capture this aspect of their nature using subtypes and inheritence.All Publicationss have titles, a specific numberOfPages and a publicationDate. They also keep track of the numberOfTimesRead. Additionally, Books have authors and ISBNs, whereas Periodicals have Volumes and issueNumbers.
Given the classes of objects, as described above,
- Initialize any type of publication, providing the properties appropriate to the type of publication, using a standard constructor
- Get a string representation of any type of publication, using the standard method for such
- Determine how many of any type of publication are in existence, as well as how many of all types of publications are in existence. This should work, even after some are deleted. It should use an appropriately named "get method", e.g. "getBookCount()"
- Get any property of any type of publication using a method named using the convention "getProperty()", e.g. getAuthor()
- It should be possible to increment the number of times any publication has been read by any positive integer -- but not decrement it
- Methods must be implemented as static methods, class method, or instance methods, as appropriate, and so designated, as appropriate.
Once you've implemented class specifications describing the classes as described above, you should instantiate and delete several different instances of various publications and exercise the methods you've written to demonstrate that your class specifications are correct.