Question
I need to Revise and shorten this assignment, Lady Who Swallowed using parameters in Java What I have so far: (works) public class There_Was_An_Old_Lady{ public
I need to Revise and shorten this assignment, "Lady Who Swallowed" using parameters in Java
What I have so far: (works)
public class There_Was_An_Old_Lady{
public static void main(String[] args) { thereWas(); System.out.println("fly"); dontKnowWhy(); insertSpace(); thereWas(); System.out.println("spider"); System.out.println("That jiggled and wiggled inside her"); sheSwallowedTheSpiderToCatchTheFly(); insertSpace(); thereWas(); System.out.println("bird"); System.out.println("How absurd, to swallow a bird"); sheSwallowedBird(); sheSwallowedTheSpiderToCatchTheFly(); insertSpace(); thereWas(); System.out.println("cat"); System.out.println("Fancy that, to swallow a cat"); sheSwallowedCat(); sheSwallowedBird(); sheSwallowedTheSpiderToCatchTheFly(); insertSpace(); thereWas(); System.out.println("dog"); System.out.println("What a hog, to swallow a dog"); sheSwallowedADog(); sheSwallowedCat(); sheSwallowedBird(); sheSwallowedTheSpiderToCatchTheFly(); insertSpace(); thereWas(); System.out.println("horse"); System.out.println("I don't know how she swallowed a horse"); sheSwallowedAHorse(); sheSwallowedADog(); sheSwallowedCat(); sheSwallowedBird(); sheSwallowedTheSpiderToCatchTheFly(); System.out.println("There was an old lady who swallowed a horse... She's dead, of course!"); } public static void thereWas(){ System.out.print("There was an old lady who swallowed a "); } public static void dontKnowWhy(){ System.out.println("I don't know why she swallowed that fly, perhaps she'll die"); } public static void insertSpace(){ System.out.println(""); } public static void sheSwallowedTheSpiderToCatchTheFly(){ System.out.println("She swallowed the spider to catch the fly"); System.out.println("But I don't why she swallowed that fly"); System.out.println("Perhaps she'll die"); } public static void sheSwallowedBird(){ System.out.println("She swallowed the bird to catch the spider"); } public static void sheSwallowedCat(){ System.out.println("She swallowed the cat to catch the bird"); } public static void sheSwallowedADog(){ System.out.println("She swallowed the dog to catch the cat"); } public static void sheSwallowedAHorse(){ System.out.println("She swallowed the horse to catch the dog"); }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started