Thanks for the help. I know what I sent isn't much but it's all I have. If you can also show me how to do a little bit more, that would be great.
1) The first day should say "A Partridge in a Pear Tree" while the other days should say "and A Partridge in a Pear Tree"
I am supposed to use conditional operator ("OR" ||) I believe.
How do I implement this?
2) At the moment its run in cmd. How do I run it in a dialog box with a scroll bar?
Hint: Use the following code to create a JTextArea and a JScrollPane which are imported from javax.swing
JTextArea songArea = new JTextArea(20, 30);
JScrollPane scroller = new JScrollPane(songArea);
songArea.setText(songString);
JOptionPane.showMessageDialog(null, scroller, "Twelve Days of Christmas",
JOptionPane.PLAIN_MESSAGE);
Should look like this:

and heres my up-to-date coding (TextArea/ScrollPane already imported but that is all):
Code
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
public class Assign5
{
public static void main(String[] args)
{
// Display Title
System.out.print(" Twelve Days of Christmas\n");
// loop-continuation condition and increment
for ( int day = 1; day <= 12; day++)
{
String strDay = "";
// determine which day (first sentence)
switch (day)
{
// First day
case 1:
strDay = "first";
break;
// Second day
case 2:
strDay = "second";
break;
// Third day
case 3:
strDay = "third";
break;
// Fourth day
case 4:
strDay = "fourth";
break;
// Fifth day
case 5:
strDay = "fifth";
break;
// Sixth day
case 6:
strDay = "sixth";
break;
// Seventh day
case 7:
strDay = "seventh";
break;
// Eighth day
case 8:
strDay = "eighth";
break;
// Ninth day
case 9:
strDay = "ninth";
break;
// Tenth day
case 10:
strDay = "tenth";
break;
// Eleventh day
case 11:
strDay = "eleventh";
break;
// Twelfth day
case 12:
strDay = "twelfth";
break;
}
String strSong = "";
// determine what was sent ( 2nd half )
switch (day)
{
// Twelfth day
case 12:
strSong += " Twelve Drummers Drumming\n";
// Eleventh day
case 11:
strSong += " Eleven Pipes Piping\n";
// Tenth day
case 10:
strSong += " Ten Lords a Leaping\n";
// Ninth day
case 9:
strSong += " Nine Ladies Dancing\n";
// Eighth day
case 8:
strSong += " Eight Maides a Milking\n";
// Seventh day
case 7:
strSong += " Seven Swans a Swiming\n";
// Sixth day
case 6:
strSong += " Six Geese a Laying\n";
// Fifth day
case 5:
strSong += " Five Golden Rings\n";
// Fourth day
case 4:
strSong += " Four Calling Birds\n";
// Third day
case 3:
strSong += " Three French Hens\n";
// Second day
case 2:
strSong += " Two Turtle Doves\n";
// First day
case 1:
strSong += " and a Partridge in a Pear Tree";
}
// Display the day of Christmas
System.out.printf( "\nOn the %s day of Christmas\n my true love sent to me:\n",
strDay);
// Display the song
System.out.printf( "%s\n", strSong);
}
}
}
This post was edited by Modification on Mar 19 2014 12:42am