I am writing a program for class that will print the "If You're Happy and You Know It" song by calling a method. I am having trouble figuring out how to print quotations around my method's action parameter.
Code:
public class ifYoureHappy {
public static void main(String[] args) {
ifYoureHappyVerse("clap your hands", "(clap clap)");
ifYoureHappyVerse("stomp your feet", "(stomp stomp)");
ifYoureHappyVerse("shout Hurray", "(hoo-ray! hoo-ray!)");
}
public static void ifYoureHappyVerse(String action, String sound) {
System.out.println("If you're happy and you know it, " + action + sound
+ "\nIf you're happy and you know it, " + action + sound
+ "\nIf you're happy and you know it, then your face will surely show it"
+ "\nIf you're happy and you know it, " + action + sound
+ "\n");
Output: If you're happy and you know it, clap your hands(clap clap) If you're happy and you know it, clap your hands(clap clap) If you're happy and you know it, then your face will surely show it If you're happy and you know it, clap your hands(clap clap)
If you're happy and you know it, stomp your feet(stomp stomp) If you're happy and you know it, stomp your feet(stomp stomp) If you're happy and you know it, then your face will surely show it If you're happy and you know it, stomp your feet(stomp stomp)
If you're happy and you know it, shout Hurray!(hoo-ray! hoo-ray!) If you're happy and you know it, shout Hurray!(hoo-ray! hoo-ray!) If you're happy and you know it, then your face will surely show it If you're happy and you know it, shout Hurray!(hoo-ray! hoo-ray!)
How do I get Hurray! to print with quotations around it, such as "Hurray!"
I have already tried changing my parameter to
ifYoureHappyVerse("shout \"Hurray!\"", "(hoo-ray! hoo-ray!);
but it didn't change anything. Please help!