Expand|Select|Wrap|Line Numbers
- import java.util.Scanner; 110 reached end of file while parsing
- public class Christmas
- {
- // main method begins execution of java appplication
- public static void main( String args[] )
- {
- // create Scanner to obtain input from command window
- Scanner input = new Scanner( System.in );
- int song = (1-12);
- for ( int song = 1; song <= 12 ; song++ )
- {
- switch ( song / 12 )
- {
- case 12: System.out.println
- ("On the twelfth day of Christmas my true love sent to me");
- break; // exit switch
- case 11: System.out.println
- ("On the eleventh day of Christmas my true love sent to me");
- break; // exit switch
- case 10: System.out.println
- ("On the tenth day of Christmas my true love sent to me");
- break; // exit switch
- case 9: System.out.println
- ("On the ninth day of Christmas my true love sent to me");
- break; // exit switch
- case 8: System.out.println
- ("On the eighth day of Christmas my true love sent to me");
- break; // exit switch
- case 7: System.out.println
- ("On the seventh day of Christmas my true love sent to me");
- break; // exit switch
- case 6: System.out.println
- ("On the sixth day of Christmas my true love sent to me");
- break; // exit switch
- case 5: System.out.println
- ("On the fifth day of Christmas my true love sent to me");
- break; // exit switch
- case 4: System.out.println
- ("On the fourth day of Christmas my true love sent to me");
- break; // exit switch
- case 3: System.out.println
- ("On the third day of Christmas my true love sent to me");
- break; // exit switch
- case 2: System.out.println
- ("On the second day of Christmas my true love sent to me");
- break; // exit switch
- case 1: System.out.println
- ("On the first day of Christmas my true love sent to me");
- break; // exit switch
- }
- switch ( song / 12 )
- {
- 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");
- case 1: System.out.println
- ("a partridge in a pear tree");
- } // end switch
- } // end class Christmas