E-mail Project: Building a Better Inbox

Assigned Monday, 2/11/02.
Due Monday, 2/18/02, by 9:00PM.

Note:

This assignment was modified on 3/5/02 to make improvements for next time...

Overview

For this assignment, you will create an Inbox class that stores a series of Messages, and provides capability for accessing a Message at will.

The assignment

For this assignment, you will create a class called Inbox with the following data value and methods:

private Message[] messages

This array contains Message objects, each of which is a message from the actual inbox.

public Inbox()

The default constructor.

public void refresh(String username, String password)

This method should clear out the array of messages, access the email server to download the file containing the current inbox, and finally create a Message object for each message to place in the array.

public int messageCount()

This method should return the number of messages contained in the array.

public Message getMessage(int messageNum)

This method should return the Message object corresponding to the messageNum given as a parameter. If messageNum is an invalid value, getMessage should return null.

public Message findMessageFrom(String from)

This method should return the first Message from the address contained in the String from. If no Message exists in the inbox from that address, findMessageFrom should return null.

You may add additional constructors and/or other private methods and data values as you see fit.

You should use the Message class that you created for Assignment 5 for this project. If you were unable to successfully make Assignment 5 work, you are welcome to use my Message.class. If you choose to use my Message.class file, click on the link and place it inside your BlueJ project folder. You will not actually see the Message object from within BlueJ, but you'll be able to use it as if it were a class built into Java.

You should use a main method to test your Inbox class. However, we will use a main method of our own to test your code when you submit it. You should therefore trade main methods with a partner in the class to help verify that your code works as it should.

Working from home

As with the previous assignments, you have to install some extra stuff on your home system if you want the project to work. Remember to do this early, since no one has tested this out for me yet! Luckily, there is nothing for this assignment that you need in addition to what was needed for Assignment #6.

Have fun, start early, and keep in touch.


Dave Musicant, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057, dmusican@carleton.edu