Email Lab

Using Sets and Maps to Create

An Email Directory


Introduction

In this lab you will complete a class EMDirectory that stores email addresses as strings. An email address can recognized because it must have the character '@'. Any string without this character is considered an alias or name under which one or more items are stored in a set. Each item stored under an alias is an email address or another alias. For simplicity aliases (names) are limited to a string with no spaces.

For example, the alias ChrisNevison may have stored under it the set containing the single email [chris@cs.colgate.edu] and the alias Jamie may have the set [jscovern@mail.colgate.edu]. On the other hand, the alias CS102 may have the set [Jamie, Leana, Oliver, Andrew, David, Frank, Montek, Steve, Victor, Brendan] stored under it. A set can have a mix of email addresses and other aliases stored. For example, CSFaculty may have the set [ChrisNevison, BarbaraCloud, pmulry@mail.colgate.edu, tparks@mail.colgate.edu].

Specifications

The starting code is in the zip file emailLab.ZIP. The EMDirectory class is already started and you are to implement the following methods:

You may assume that your directory has no cycles (one alias leads to a second leads back to the first).

To Do

Complete the code for the class EMDirectory.

Extra credit:

Modify the expandEmails method so that it will still work even if the directory has cycles in it.

If you want to experiment with a GUI, see if you can create a simple GUI for this program using the Java swing package.