Given the following abstraction:
A book is a collection of chapters, which are each collections of pages.
sketch out the code for the Book, Chapter, and Page classes.
Invent whatever attributes you think would be relevant, taking advantage of collections as attributes where appropriate.
Include methods on the Chapter class for adding pages, and for determining how many pages a chapter contains.
Include methods on the Book class for adding chapters, for determining how many chapters the book contains, for determining how many pages the book contains (hint: use delegation!), and for printing out a book's table of contents.
What generic type(s) of collection(s)—ordered list, sorted ordered list, set, dictionary—might you use to represent each of the following abstractions? Explain your choices.
A computer parts catalog
A poker hand
Trouble calls logged by a technical help desk
What collections do you think it would be important to maintain for the SRS, based on the requirements presented in the Introduction to this book?
What collections do you think it would be important to maintain for the Prescription Tracking System (PTS) described in Appendix B?
What collections do you think it would be important to maintain for the problem area that you described for exercise 3 in Chapter 2?