ICT 4361 — Java Programming Exercise 5

Purpose:

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

Our approach will be based on a simple Mad-Libs exercise, based on an exercise for the MIT introductory course to Java ( MIT OpenCourseWare Java Preparation Course). We will take this exercise, and then add a file-parsing front-end on it for the next homework exercise.

There are many ways to extend this exercise.

You can check out Madlibs.org to see how a web front end is added to a similar capability.

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.

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 each question asked, provide one or two sentences summarizing your answer. Please be both complete and succinct.

Problems:

  1. Start with the homework starter files. These will give you a good framework for creating your Madlibs. Describe why they will not compile as they are.
  2. Examine the MadLibEntry abstract class, and create the two derived classes TextEntry and Slot. Be sure to implement all the abstract methods.
  3. Add fields and methods to the MadLib class. These should include a container for MadLibEntries, appropriate constructors, and the methods outlined in the class starter.
  4. Compile and run the MadHello program. When you have implemented the above, it should compile and run
  5. Compile and run the MadHamlet program.
  6. Optional: Run the JUnit tests and make them all pass

Notes:

Evaluation Criteria:

CriteriaWeight
Answer for problem 110
MadLibEntry class15
TextEntry derived class and test10
SlotEntry derived class and test15
MadLib class completion20
MadHello program and output15
MadHamlet program and output15