Share

No Title

Public

26 January 2021

Views: 9

public class Song{

//These verseend functions will be used to nest in frequent lines of the song, thus removing as much simple redundancy as possible
public static void Verseend1(){
System.out.println("I don't know why she swallowed that fly,");
System.out.println("Perhaps she'll die.");
}

public static void Verseend2(){
System.out.println("She swallowed the spider to catch the fly,");
Verseend1();
}
public static void Verseend3(){
System.out.println("She swallowed the bird to catch the spider,");
Verseend2();
}
public static void Verseend4(){
System.out.println("She swallowed the cat to catch the bird,");
Verseend3();
}
public static void Verseend5(){
System.out.println("She swallowed the dog to catch the cat,");
Verseend4();
}
public static void Verseend6(){
System.out.println("She swallowed the coyote to catch the dog,");
Verseend5();
}

//Here is our song's verse with the verse ending functions nested in

public static void Verseone(){
System.out.println("There was an old woman who swallowed a fly.");
Verseend1();
System.out.println();
}
public static void Versetwo(){
System.out.println("There was an old woman who swallowed a spider,");
System.out.println("That wriggled and iggled and joggled inside her.");
Verseend2();
System.out.println();
}
public static void Versethree(){
System.out.println("There was an old woman who swallowed a bird,");
System.out.println("How absurd to swallow a bird.");
Verseend3();
System.out.println();
}
public static void Versefour(){
System.out.println("There was an old woman who swallowed a cat,");
System.out.println("Imagine that to swallow a cat.");
Verseend4();
System.out.println();
}
public static void Versefive(){
System.out.println("There was an old woman who swallowed a dog,");
System.out.println("What a hog to swallow a dog.");
Verseend5();
System.out.println();
}
public static void Versesix(){
System.out.println("There was an old woman who swallowed a coyote,");
System.out.println("what a load of macaroni to swallow a coyote.");
Verseend6();
}
public static void Song(){
Verseone();
Versetwo();
Versethree();
Versefour();
Versefive();
Versesix();
System.out.println();
System.out.println("There was an old woman who swallowed a horse,");
System.out.println("She died of course.");

}


public static void main(String[] args){

Song();

}

}

Advertisement

Disable Third Party Ads