PhotoGallery
We want to realize a Java class PhotoGallery
that represents an
online photo gallery. Each PhotoGallery has an url (represented by a
string), and contains photos, each represented simply as a string that denotes
the link to the actual photo. The functionalities of the objects of the class
are:
true
if the photo is present in the
PhotoGallery; false
otherwise;Part 1. Realize the class PhotoGallery.
Solution: representation of the objects, skeleton of the class, recursive implementation, iterative implementation, implementation using dynamic arrays,
Part 2. Realize a client class of the class
PhotoGallery
containing a static method readFromFile
that takes as parameters a string f that represents a filename
containing photos (i.e., strings) and a PhotoGallery g, and adds
to g all photos present in the file f.
Part 3. Briefly discuss the advantages and limitations of dynamic arrays with respect to linked lists.