QUOTE(baavgai @ 16 Feb, 2008 - 07:55 PM)

A few issues:
CODE
// this
while (!animal.equals("no more")) {
System.out.println("Thanks for playing!");
break;
}
// is identical to this
if (!animal.equals("no more")) {
System.out.println("Thanks for playing!");
}
This doesn't do anything other than print something if a condition is met. In particular, it doesn't make you leave the program.
Also, your
String no_more = stdin.next(); is kind of meaningless.
Here's a little pseudo code to get you going:
CODE
// this is a forever loop, your code inside will decide when you can leave.
while true do
prompt user
get input
if input is exit flag then break from loop
prompt user again
get more input
show results
end while
Hope this helps.
This is what I came up with, might be ugly but does the job perfectly:
CODE
public static void main(String[] args)
{
Scanner stdin = new Scanner(System.in);
System.out.println("Let's sing \"Old MacDonald had a farm\": ");
System.out.println("Please enter an animal and noise, or no more to stop playing.");
String animal = stdin.next();
String noise = stdin.next();
while ((!"no".equals(animal)) & (!"more".equals(noise)))
{
System.out.println();
printFirstLast();
printMiddleVerse(animal, noise);
printFirstLast();
System.out.println();
System.out.println("Please enter an animal and noise, or no more to stop playing.");
animal = stdin.next();
noise = stdin.next();
}
}
public static void printFirstLast()
{
System.out.println("Old MacDonald had a farm, E-I-E-I-O.");
}
public static void printMiddleVerse(String animal, String noise)
{
System.out.println("And on that farm he had some " + animal + ", E-I-E-I-O ");
System.out.println("With a " + noise + "-" + noise + " here, and a " + noise + "-" + noise + " there");
System.out.println("Here a " + noise + ", there a " + noise);
System.out.println("Everywhere a " + noise + "-" + noise);
}
}