CIS 1068 - Homework 2

Handed out: 1/26/10
Due: by 10pm on 2/1/10


The task is to write a Java class that prints out a nursery rhyme, as described below. Your program will be graded on whether or not it prints out the correct output and on whether the program has a good structure.

Program Description

You will write a Java class called ThisHouse that must be saved into a file called ThisHouse.java. Your program should produce the following nursery rhyme as output:
This is the house that Jack built.
This is the malt
That lay in the house that Jack built.
This is the rat
That ate the malt
That lay in the house that Jack built.
This is the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the cow with the crumpled horn
That tossed the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the maiden all forlorn
That milked the cow with the crumpled horn
That tossed the dog
That worried the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
You should exactly reproduce the format of this output. This includes having identical wording, spelling, spacing, punctuation, and capitalization. Please do not include any extra verses. You may include blank lines at the end of the output, if you like. You do not need to reproduce the lines surrounding the text, only the text itself.

Stylistic Guidelines

One way to write this program would be to simply write a println statement that outputs each line of the rhyme in order. However, such a solution would not receive full credit. Part of the challenge of this assignment lies in recognizing the structure and redundancy of the rhyme and improving the code using static methods. Any println statement in your program should not be in your main method. Instead, use static methods in this program, for two reasons: