Project #4 CMSC 131
Due Tuesday 3/14/06 at 11:00 PM Object-Oriented Programming I
Type of project: Closed Spring 2006

Objective

To practice using the String class, writing classes from scratch, and writing JUnit test cases.

Overview

Note that this project is CLOSED.  Please review the course policy on open/closed projects before you begin.

For this project you will write three classes:  Name, Address, and Letter.  You will also write an extensive set of JUnit tests, which should test all of the methods you have written in your classes.  This project is different from most projects in this course, because there is no main() method anywhere.  What you are creating are three re-useable modules (Name, Address, and Letter) that could later be made part of a complete program.

Put all of your work (Name.java, Address.java, and Letter.java) in the folder we have provided labeled "src".

 

Tests

 

Java API that will be helpful

Before beginning this project, you may want to look over the online documentation for the Java String class.  You will need to make use of some of the methods you can read about there.  You should also familiarize yourself with the static method called "isLetter", which is part of the Character class.  You'll need it!


Writing the Classes

We are leaving many decisions about the implementation of these classes for you to decide.  Below are descriptions of the classes you must write.

 

Name Class

The "state" for a Name object consists of two fields, described below.  You may also include any static constants that you think are useful.

Private fields

The methods you must write are described below.  As mentioned previously, we are intentionally leaving a lot of decisions about how to write these methods for you to decide.  In particular, you must decide which of these things (if any) should be static.  In addition to the methods below, please feel free to also include as many private methods as you find useful.

Public methods

Important:  Anyplace the first and last name are set, the mutators above (setFirst and setLast) should be called.  This includes the constructors that you are writing for this class.

Private methods

 

Address Class

The "state" for an Address object consists of the following fields:

Private fields

The methods you must write are described below.  As mentioned previously, we are intentionally leaving a lot of decisions about how to write these methods for you to decide.  In particular, you must decide which of these things (if any) should be static.  In addition to the methods below, please feel free to also include as many private methods as you find useful.

Public methods

 

Letter Class

The "state" for a Letter object consists of the following fields:

Private fields:

The methods you must write are described below.  As mentioned previously, we are intentionally leaving a lot of decisions about how to write these methods for you to decide.  In particular, you must decide which of these things (if any) should be static.  In addition to the methods below, please feel free to also include as many private methods as you find useful.

Public methods

FROM:

Bob Smith

7373 Maple Street

Beltsville, MD 20705

TO:

Jane Doe

97663 Main Street

Arlington, VA 22206

CONTENT:

Hello Jane, How are you?

 

Requirements

 

Grading

Your grade will be determined as follows:

Web Accessibility