Programming in Java Spring 2006

Command Oriented Personal Information Manager

Due Date: March 5th (by 11:59PM)
Submit via WebCT drop box labeled HW3

Assignment

This assignment involves the creation of simple Personal Information Management system that can deal with 4 kinds of items: todo items, notes, appointments and contacts. Each of these kinds of items is described in more detail below. The assignment requires that you create a class for each item type, and that each class extends an abstract base class provided for you. In addition to creating the four classes, you need to create a manager class that supports some simple text-based commands for creating and managing items.

Each of your 4 item type classes will be derived from the following abstract class: (also available as PIMEntity.java)

public abstract class PIMEntity {
    String Priority; // every kind of item has a priority
	static int nextid=0; // each entity has a unique id
	protected int id;

    // default constructor sets priority to "normal"
    PIMEntity() {
        Priority = "normal";
		id = nextid++;
    }

    // priority can be established via this constructor.
    PIMEntity(String priority) {
        Priority =  priority;
		id = nextid++;
    }

    // accessor method for getting the priority string
    public String getPriority() {
        return Priority;
    }

    // method that changes the priority string
    public void setPriority(String p) {
        Priority = p;
    }

    // This is actually already defined by the super class
    // Object, but redefined here as abstract to make sure
    // that derived classes actually implement it
    abstract public String toString();
}

Feel free to augment the PIMEntity class with additional methods and/or fields, but don't remove anything that is there.

PIMTodo

Todo items must be based on (extend) PIMEntity and defined in a class named PIMTodo. Each todo item must have a priority (a string), a date and a string that contains the actual text of the todo item.

PIMNote

Note items must be based on (extend) PIMEntity and be defined in a class named PIMNote. Each note item must have a priority (a string), and a string that contains the actual text of the note.

PIMAppointment

Appointment items must be based on (extend) PIMEntity and be defined in a class named PIMAppointment. Each appointment must have a priority (a string), a date and a description (a string).

PIMContact

Contact items must be based on (extend) PIMEntity and be defined in a class named PIMContact. Each contact item must have a priority (a string), and strings for each of the following: first name, last name, email address.

There is one additional requirement on the implementation of the 4 item classes listed above, the 2 classes that involve a date must share an interface that you define. You must formally create this interface and have both PIMAppointment and PIMTodo implement this interface. The interface should facilitate some way of getting and setting the date associated with these types of PIMEntitys

PIMManager

You must also create a class named PIMManager that includes a main and provides some way of creating and managing items (from the terminal). You must support the following commands (functionality):

When creating a new item it is expected that the user must response to a sequence of prompts to enter the appropriate information (and even to indicate what kind of item is being created). Do this any way you want, just make sure that your system provides enough information (instructions) so that we can use your systems!

There is no required format for the user interface, anything that allows users to create, list, save and load is fine. Here is what it might look like (user input shown in red):
java PIMManager

Welcome to PIM.
---Enter a command (suported commands are List Create Save Load Quit)---
List
There are 0 items.
---Enter a command (suported commands are List Create Save Load Quit)---
Create
Enter an item type ( todo, note, contact or appointment )
todo
Enter date for todo item: 
2/24/02
Enter todo text:
Submit java homework.
Enter todo priority:
urgent
---Enter a command (suported commands are List Create Save Load Quit)---
List
There are 1 items.
Item 1: TODO urgent 02/24/2002 Submit Java homework.
---Enter a command (suported commands are List Create Save Load Quit)---
Save
Items have been saved.
---Enter a command (suported commands are List Create Save Load Quit)---
Quit


Note that there is not a required Delete command. Feel free to use any data structure you want to hold a list of items, you are allowed to use a simple array with size 100 (you are not required to support lists of more than 100 items). We will talk about the various kinds of collection objects supported by java.util (but you don't need to use them for this assignment).

File I/O: you need to be able to save a list of items to a file (and to read from a file). You should use take advantage of Java's support for Object Serialization! Make your objects Serializable objects and use Object streams to read and write objects.

How to submit

Log in to WebCT at webct.rpi.edu using your RCS id and password. Once you get to MyWebCT click on "Programming in Java", and from there go to the homework drop boxes. Submit your files (individually, zipped, tarred or a jar file) to the drop box labeled HW3

Don't send compiled code (class files)!

Your submission must include the files:

All code must be commented using javadoc comments. See the lecture notes on javadoc for details about what is required.

How to submit

Don't send compiled code (class files)!

You can expect a return email indicating receipt of your project submission immediately. This receipt will include a list of all the files that were successfully extracted by the submission script - please look over the receipt carefully to make sure your submission worked.