The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
February 2002

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Need More Help

Posted by Patti on February 19, 2002 at 1:44 PM

How do I get the combos of cases to print? I think I'm going crazy!!

import java.io.*;

public class ChristmasSong
{
public static void main (String[] args)
{
int verse = (1-12);
int day = (13-24);

{
switch (verse) {
case 12: System.out.println("Twelve drummers drumming");
case 11: System.out.println("Eleven pipers piping");
case 10: System.out.println("Ten lords a leaping");
case 9: System.out.println("Nine ladies dancing");
case 8: System.out.println("Eight maids a milking");
case 7: System.out.println("Seven swans a swimming");
case 6: System.out.println("Six geese a laying");
case 5: System.out.println("Five golden rings");
case 4: System.out.println("Four calling birds");
case 3: System.out.println("Three French hens");
case 2: System.out.println("Two turtle doves, and");
case 1: System.out.println ("A partridge in a pear tree");
}

switch (day){
case 24: System.out.println ("On the 12th day of Christmas my true love gave to me");
case 23: System.out.println ("On the 11th day of Christmas my true love gave to me");
case 22: System.out.println ("On the 10th day of Christmas my true love gave to me");
case 21: System.out.println ("On the 9th day of Christmas my true love gave to me");
case 20: System.out.println ("On the 8th day of Christams my true love gave to me");
case 19: System.out.println ("On the 7th day of Christmas my true love gave to me");
case 18: System.out.println ("On the 6th day of Christmas my true love gave to me");
case 17: System.out.println ("On the 5th day of Christmas my true love gave to me");
case 16: System.out.println ("On the 4th day of Christmans my true love gave to me");
case 15: System.out.println ("On the 3rd day of Christmas my true love gave to me");
case 14: System.out.println ("On the 2nd day of Christmas my true love gave to me");
case 13: System.out.println ("On the 1st day of Christmas my true love gave to me");
}






}
}
}





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us