public class Actor { private int id; private static int count = 0; private String name; private Date birthday; private Address homeAddress; private Movie[] movies; public Actor(String theName, Date theBirthday, Address theHomeAddress) { id = count; count++; name = theName; birthday = theBirthday; homeAddress = theHomeAddress; } public int getId() { return id; } public String getName() { return name; } public Date getBirthday() { return birthday; } public Address getHomeAddress() { return homeAddress; } // Schauspieler können umziehen. public void setHomeAddress(Address theHomeAddress) { homeAddress = theHomeAddress; } public Movie[] getMovies() { return movies; } // Actor nicht veränderbar, außer bei den Filmen, in denen er mitspielt. // Anwendungsfall: neuer Film mit Benedict Cumberbatch erscheint. public void setMovies(Movie[] theMovies) { movies = theMovies; } // Format: Name, born Jahr (Anzahl Filme movies) // Beispiel: Benedict Cumberbatch, born 1976 (74 movies) public String toString() { return name + ", born " + Integer.toString(birthday.getYear()) + " (" + Integer.toString(movies.length) + " movies)"; } }