write a program that produces as output the words of \"The House That Jack Built
ID: 3627071 • Letter: W
Question
write a program that produces as output the words of "The House That Jack Built." Use methods for each verse and for repeated text. Here are lyrics to use:This is the house that Jack Built.
This is the malt
That lay in the house that Jack built.
This is the rat,
That ate the malt
That lay in the house that Jack built.
This is the cat,
That killed the rat,
That ate the malt
That lay in the house that Jack built.
This is the dog,
That worried the cat,
That killed the rat,
That ate the malt
That lay in the house that Jack built.
This is the cow with the crumpled horn,
That tossed the dog,
That worried the cat,
That killed the rat,
That ate the malt
That lay in the house that Jack built.
This is the maiden all forlorn
That milked the cow with the crumpled horn,
That tossed the dog,
That worried the cat,
That killed the rat,
That ate the malt
That lay in the house that Jack built.
Explanation / Answer
please rate - thanks
import java.util.*;
public class houseThatJackBuilt
{
public static void main(String args[])
{line1();
verse1();
verse2();
verse3();
verse4();
verse5();
verse6();
}
public static void line1()
{System.out.println("This is the house that Jack Built.");
}
public static void verse1()
{System.out.println("This is the malt");
lastLine();
}
public static void verse2()
{
System.out.println("This is the rat,");
complete();
}
public static void verse3()
{System.out.println("This is the cat,");
killedRat();
}
public static void complete()
{System.out.println("That ate the malt");
lastLine();
}
public static void lastLine()
{
System.out.println("That lay in the house that Jack built.");
System.out.println();
}
public static void killedRat()
{System.out.println("That killed the rat,");
complete();
}
public static void verse4()
{
System.out.println("This is the dog,");
worriedCat();
}
public static void worriedCat()
{
System.out.println("That worried the cat,");
killedRat();
}
public static void verse6()
{System.out.println("This is the maiden all forlorn");
System.out.println("That milked the cow with the crumpled horn,");
tossedDog();
}
public static void verse5()
{System.out.println("This is the cow with the crumpled horn,");
tossedDog();
}
public static void tossedDog()
{System.out.println("That tossed the dog,");
worriedCat();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.