EX 6: Composite Pattern

An email contact consists of a name and a mailing address. A group of contacts can form a mailing list. Mailing lists can also be combined to form larger lists. Draw a detailed class diagram showing how to us the Composite Pattern on this problem. Include a method which returns the email address or addresses, where where all email addresses in a list are separated by semicolons. In addition, apply the Strategy Pattern to allow formatting email addresses; this would have a method that would return the address formatted to some standard. For example, the Microsoft format would be

        Last, First <email@address.domain>
Allow other formats as well, such as first.last@address.domain. Your diagram must include generalization, multiplicities, attributes, methods, and associations. The diagram must be hand-drawn and must be readable. Only show "simple" attributes (ones without identity) in the classes; if the type of an attribute is another class on the diagram, show that relationship with an association.

In addition, draw a sequence diagram (by hand) showing what happens (at the application level) when when the "full office" email list to use the first.last@address.domain address, and Lucinda Robinson (an external contact) is set to use the Microsoft format. Assume this list is being written to a file in response to a command from the user. Be sure your sequence diagram reflects how the system is using the composite and strategy patterns.

Your answer can be on one or on two separate sheets. You'll upload one or two PDFs in response.