FormLetterVisualization.png
Visualization of Form Letter Formation: Template applies property files to produce form letters
HW5FormLetter_ClassDiagram.png
HW5 Form Letter Class Diagram
HW5FormLetter.png
HW5 Form Letter Composition

ICT-4361 Homework 5a

Purpose

This exercise will familiarize you with using polymorphic containers and text processing in Java.

We will use the idea of “form letter processing” to convey these ideas.

Form letters are a way of combining a form letter template (text and placeholders for substitution) with a data collection (say, names and addresses) and some computed variables (such as the date) to create a useful result (say, a personalized business letter).

In this exercise we will create the structures for the template, and show that we can process the template to produce the appropriate results.

In the followup exercise for next week, the data collections and output will use files rather than internal storage.

What to Hand In

Please hand in a listing for each program requested, formatted in an easy-to-read style.
Ensure your name, and the name of the file is available in a comment at the top of the file.
You do not need to submit files from the homework starter files that are unchanged.
Also, ensure that you have a sample of the output from the program.
If your program fails to compile, hand in your error listing as your output.
For electronic submission, “zip” your submission together into a single file, to ensure nothing is missing;
For each question asked, provide one or two sentences summarizing your answer. Please be both complete and succinct.

Problems

  1. Create and Test a Form Letter
    1. Start with the homework starter files. These will give you a good framework for creating your FormLetterTemplate.
    2. Examine the FormLetterEntry abstract class, and create the two derived classes TextEntry and DataItemEntry. Be sure to implement all the abstract methods in each derived class.
    3. Add fields and methods to the FormLetter class. These should include a container for FormLetterEntrys, appropriate constructors, and the methods outlined in the class starter.
    4. Compile and run the FormLetterHello program. When you have implemented the above, it should compile and run.
    5. Capture the output of your test run for your submission.
    6. Create a new class called MyFormLetter, which represents another example of a form letter. It must contain at least one TextEntry and at least one DataItemEntry. Compile it, run it, and same the output of your test run for your submission.
    7. Optional: Run the JUnit tests and make them all pass (this might take minor changes to your classes).
      You will need to ensure the JUnit libraries are on your classpath.
      If you submit this optional part, be sure to capture the output showing the JUnit tests passed and include with your submission.
  2. Question: Describe why these files will not compile as they are. Be specific, and display some confirmation for your description. The answer may be stored in a text file, or incorporated as comments in your code.

Notes

Evaluation

Criteria Weight
Answer for the question, including justification 10%
TextEntry derived class and test 20%
DataItemEntry derived class and test 20%
FormLetter class completion 20%
FormLetterHello test program and output 15%
MyFormLetter test program and output 15%
JUnit tests completed and output +5%