Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please read the requirements, especially the comlex reduncy This program uses concepts from Chapter 1 in the textbook. You are going to write a Java

Please read the requirements, especially the comlex reduncy

image text in transcribedimage text in transcribed

This program uses concepts from Chapter 1 in the textbook. You are going to write a Java program in a file named Song.java that produces as output a cumulative song in which successive verses build on previous verses. Your program will output to the console window the lyrics of the song show below. The final version of your program will use a structured solution by employing procedural decomposition to eliminate redundancy and to capture the structure of the song. There was an old woman who swallowed a fly. I don't know why she swallowed that fly, Perhaps she'll die. There was an old woman who swallowed a spider, That wriggled and iggled and jiggled inside her. She swallowed the spider to catch the fly, I don't know why she swallowed that fly, Perhaps she'll die. There was an old woman who swallowed a bird, How absurd to swallow a bird. own a biratch the spider, She swallowed the bird to catch the spider, She swallowed the spider to catch the fly, I don't know why she swallowed that fly, Perhaps she'll die. There was an old woman who swallowed a cat, Imagine that to swallow a cat. She swallowed the cat to catch the bird, She swallowed the bird to catch the spider, She swallowed the spider to catch the fly, I don't know why she swallowed that fly, Perhaps she'll die. There was an old woman who swallowed a dog, What a hog to swallow a dog. She swallowed the dog to catch the cat, She swallowed the cat to catch the bird, She swallowed the bird to catch the spider, She swallowed the spider to catch the fly, I don't know why she swallowed that fly, Perhaps she'll die. There was an old woman who swallowed a horse, She died of course. Your program will use static methods and printin statements. The final version of your program will employ procedural decomposition to create a structured program that eliminates redundancy as demonstrated in sections 1.4 Procedural Decomposition and 1.5 Case Study: DraweLaures in the textbook. Java Language Elements Use only Java language elements covered in Chapter 1 of the text. Use only println statements for producing the output. Do not use System.outraprint statements or the escape sequence, even though they were presented in Chapter 1. Do not have any printin statements in main().main () just calls the other methods in the program described below. Procedural Decomposition Capture the structure of the song: Use static methods to capture the structure of the song. You must, for example, have a different method for each of the six verses of the song, where verses are shown separated by blank lines in the output shown in the overview above. Eliminate redundancy: o Use exactly one printin statement for each distinct line of the song. For example, this line: Perhaps she'll die. appears several times in the output. You are to have exactly one printin statement in your program for producing this line, and exactly one for each distinct line in the song. In other words, no two System autoprintin statements have the same message inside the parentheses ()-except the statement for displaying an empty line. You may have multiple such printin statements for that purpose. The more complex redundancy involves pairs of lines like these: She swallowed the dog to catch the cat, She swallowed the cat to catch the bird, The key question to ask yourself is "Do I have repeated lines of code that could be eliminated if I structured my static methods differently?" This will involve methods calling other methods that contain the printita statements needed. If you end up with a total of more than 12 methods in your program you have gone too far in your efforts to eliminate redundancy

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

5. Develop the succession planning review.

Answered: 1 week ago