Free University of Bozen-Bolzano
Faculty of Computer Science - Bachelor in Applied Computer Science
Introduction to Programming - A.A. 2004/2005

Exam exercise
Class 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:


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.

Solution


Part 3. Briefly discuss the advantages and limitations of dynamic arrays with respect to linked lists.