Hi i have a bit of code:
On the 1st day of Christmas,
my true love sent to me
A partridge in a pear tree.
On the 2nd day of Christmas,
my true love sent to me
Two turtle doves,
And a partridge in a pear tree.
On the 3rd day of Christmas,
my true love sent to me
Three French hens,
Two turtle doves,
And a partridge in a pear tree.
how would i display it with out methods or arrays to display Each line of the song should only appear once in your code?
I managed so far :
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package christmas;
/**
*
* @author Libra
*/
public class Christmas {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
for (int i = 1; i <= 3; i++) {
String output = "On the" + i +" day of Christmas,\n" + "my true love sent to me \n";
System.out.println(output);
switch(i)
{
case 3:
String line1 = "Three French hens,\n" +
"Two turtle doves,\n" +
"And a partridge in a pear tree. " ;
System.out.println(output=line1);
case 2:
String line2 = "Two turtle doves,\n" +
"And a partridge in a pear tree. ";
System.out.println(output=line2);
}
}
}
}