Alrighty, so I have to do this assignment for my Java course, using a switch statement. The assignment is to have the user enter a number (1-5), and have the corresponding line of a poem be displayed. So if the user entered 1, "One two, buckle your shoe" would be displayed. This is what I have and it's giving me a huge problem:
import java.util.Scanner;
public class Poem
{
public static void main(String[] args);
Scanner kboard = new Scanner(System.in);
System.out.println("Enter a number 1-5 (or 0 to quit).");
int n = kboard.nextLine();
switch (n) {
case 1: System.out.println("One two, buckle your shoe.");
break;
case 2: System.out.println("Three four, shut the door.");
break;
case 3: System.out.println("Five six, pick up sticks.");
break;
case 4: System.out.println("Seven eight, lay them straight.");
break;
case 5: System.out.println("Nine ten, a big fat hen.");
break;
default: System.out.println("Goodbye.");
break;
}
}
}
This is giving me a HUGE string of errors. (Something like 45). I'm wracking my brain here trying to figure this out. Any help is greatly appreciated. Thanks!