CMPS 134 Fall 2025
Programming Assignment #1: The Rattlin' Bog
Due Time/Date: 11:59pm, Tuesday, Sept. 9

Requirements

According to the Wikipedia entry:

A cumulative song is a song having a simple verse structure modified by progressive addition so that each verse is longer than the verse before.

An example of such a song that is probably familiar to you is The Twelve Days of Christmas.

For this assignment, you are to develop a Java application named RattlingBog that produces as output the lyrics —or most of them, anyway— of the cumulative Irish folk song The Rattlin' Bog. (The lyrics appear below.)

To give you a start, provided is a very poor solution in which the main() method simply prints every line of the song, one after the other.

Employing the technique of procedural decomposition, you should "refactor" the given program in order to improve its structure and to greatly reduce the amount of redundancy in its code. (For an analogy, recall from lecture how the DrawFigures1 program was transformed into DrawFigures2 and then DrawFigures3. Links to all three are on the course web page.) A goal to aim for is to make the program such that each distinct line of the song appears only once within it (as a literal String).


The println() Method

You will notice that the given program includes a method println() that acts as a "surrogate" for System.out.println(). The purpose of doing so is simply to de-clutter the program by making, for example, the statement println("cat") have the same effect as the more verbose System.out.println("cat"). If you would prefer to use the more verbose form, that is permissible.


Submission of Program

Submit your source code file (which must be named RattlingBog.java) to the appropriate Brightspace dropbox. Do not submit the associated .class file.

The program that was provided to you (see link above) includes a comment describing the purpose/behavior of the program; a comment identifying the course, semester, and assignment number; and comments intended to identify the program's author (you!) and those who helped you to develop the program. Also included is a comment intended for you to describe any known defects of your program. Consider this to be a template that you are expected to follow in all subsequent assignments.


The Lyrics

The song's lyrics are shown below in two columns; it is to be understood that the column on the left precedes the one to its right, consistent with the numbering of the verses.

Lyrics of The Rattlin' Bog
Ho ro the rattlin' bog
The bog down in the valley-o.
Ho ro the rattlin' bog
The bog down in the valley-o.
(chorus)
Now in this bog there was a tree
A rare tree, a rattlin' tree.
The tree in the bog and
The bog down in the valley-o.
(verse 1)
Ho ro the rattlin' bog
The bog down in the valley-o.
Ho ro the rattlin' bog
The bog down in the valley-o.
chorus
And on this tree there was a limb
A rare limb, a rattlin' limb.
The limb on the tree and
The tree in the bog and
The bog down in the valley-o.
(verse 2)
Ho ro the rattlin' bog
The bog down in the valley-o.
Ho ro the rattlin' bog
The bog down in the valley-o.
(chorus)
And on this limb there was a branch
A rare branch, a rattlin' branch.
The branch on the limb and
The limb on the tree and
The tree in the bog and
The bog down in the valley-o.
(verse 3)
Ho ro the rattlin' bog
The bog down in the valley-o.
Ho ro the rattlin' bog
The bog down in the valley-o.
(chorus)
And on this branch there was a twig
A rare twig, a rattlin' twig.
The twig on the branch and
The branch on the limb and
The limb on the tree and
The tree in the bog and
The bog down in the valley-o.
(verse 4)
Ho ro the rattlin' bog
The bog down in the valley-o.
Ho ro the rattlin' bog
The bog down in the valley-o.
(chorus)
And on this twig there was a leaf
A rare leaf, a rattlin' leaf.
The leaf on the twig and
The twig on the branch and
The branch on the limb and
The limb on the tree and
The tree in the bog and
The bog down in the valley-o.
(verse 5)
Ho ro the rattlin' bog
The bog down in the valley-o.
Ho ro the rattlin' bog
The bog down in the valley-o.
(chorus)