English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Am finished but it says that ; is expected on lines 26 and 70. I don't know how to fix that. Please help?

public class TwelveDays
{
public static void main( String args[] )
{
String Day1 = "a partridge in a pear tree";
String Day2 = "two turtle doves";
String Day3 = "three french hens";
String Day4 = "four calling birds";
String Day5 = "five golden rings";
String Day6 = "six geese a laying";
String Day7 = "seven swans a swimming";
String Day8 = "eight maids a milking";
String Day9 = "nine ladies dancing";
String Day10 = "ten lords a leaping";
String Day11 = "eleven pipers piping";
String Day12 = "twelve drummers drumming";

String Day;
String output;

for(int i=1;i<=12;i++){
Day = "";
output = "";

Switch(i)
{
case 1:
Day = "first";
break;
case 2:
Day = "second";
break;
case 3:
Day = "third";
break;
case 4:
Day = "fourth";
break;
case 5:
Day = "fifth";
break;
case 6:
Day = "sixth";
break;
case 7:
Day = "seventh";
break;
case 8:
Day = "eighth";
break;
case 9:
Day = "ninth";
break;
case 10:
Day = "tenth";
break;
case 11:
Day = "eleventh";
break;
case 12:
Day = "twelfth";
break;
}

output = "On the " + Day + "of Christmas, my true love sent to me: ";

for(int k=i; k>=1; k--){

Switch(k)
{
case 1:
output = output + Day1 + "." + "\n";
break;
case 2:
output = output + Day2 + ",";
break;
case 3:
output = output + Day3 + ",";
break;
case 4:
output = output + Day4 + ",";
break;
case 5:
output = output + Day5 + ",";
break;
case 6:
output = output + Day6 + ",";
break;
case 7:
output = output + Day7 + ",";
break;
case 8:
output = output + Day8 + ",";
break;
case 9:
output = output + Day9 + ",";
break;
case 10:
output = output + Day10 + ",";
break;
case 11:
output = output + Day11 + ",";
break;
case 12:
output = output + Day12 + ",";
break;
}

}

System.out.println(output);

}

}

2007-02-22 12:14:29 · 1 answers · asked by bloodyhell1981 1 in Computers & Internet Programming & Design

1 answers

switch needs to be lowercase.

2007-02-22 12:25:48 · answer #1 · answered by cs_gmlynarczyk 5 · 1 0

fedest.com, questions and answers