Free University of Bozen-Bolzano
Bachelor in Production Engineering
Introduction to Programming - A.A. 2005/2006
5 CFU

Written Exam 29/6/2006

We want to design a Java class for representing and manipulating lists of birthdays of persons.

Part 1. (4 points) For each Birthday object, the information of interest is:

Realize a Java class Birthday, to represent Birthday objects, that exports the following functionalities:

Part 2. (16 points) Realize a Java class BirthdayList, to represent BirthdayList objects. Each birthday list is constituted by a sequence of birthdays, where each birthday is an instance of the class Birthday. A BirthdayList has also a size, which determines the maximum number of birthdays it can contain. The class BirthdayList should export the following functionalities:

Part 3. (6 points) Realize a static method personsWithBirthday, client of the class BirthdayList (i.e., external to such a class) that, given a BirthdayList object bl and a month m (an integer), writes on standard output the name and day of the month of the birthday for all those persons in the list bl whose birthday is in month m, one name per line.

Part 4. (4 points) Discuss the different types of errors that a Java program may contain, and give for each of them an example.