Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Notes: One way to write this program would be to simply write a println statement that outputs each line of the song in order. However,

image text in transcribed

Notes: One way to write this program would be to simply write a println statement that outputs each line of the song in order. However, such a solution would not receive full credit. Part of the challenge of this assignment lies in recognizing the structure and redundancy of the song and improving the code using static methods. You should not place any println statements in your main method. (It is okay for main to have empty println statements to print blank lines.) Instead of printing in main, use static methods for two reasons: i. To capture the structure of the song's five verses. You should write static methods to capture the structure of the song. You should, for example, have a method for each of the five verses of the song to print that verse's entire contents. ii. To avoid simple redundancy in the output. You should use only one println statement for each distinct non-blank line of the song. For example, the following line appears several times in the output, but you should have only one println statement in your program that prints that line of the song: Cat goes fiddle-i-fee. However, a method that prints a single line such as the above is not useful. Instead, you should identify groups of two or more lines that appear in multiple places in the song and create static methods that capture those groups and are called multiple times. There is a general structural redundancy to the song that you should eliminate with your static methods. Recall that methods can call other methods if necessary. The key question to ask yourself is whether or not you have repeated lines of code that could be eliminated if you structured your static methods differently, Notes: One way to write this program would be to simply write a println statement that outputs each line of the song in order. However, such a solution would not receive full credit. Part of the challenge of this assignment lies in recognizing the structure and redundancy of the song and improving the code using static methods. You should not place any println statements in your main method. (It is okay for main to have empty println statements to print blank lines.) Instead of printing in main, use static methods for two reasons: i. To capture the structure of the song's five verses. You should write static methods to capture the structure of the song. You should, for example, have a method for each of the five verses of the song to print that verse's entire contents. ii. To avoid simple redundancy in the output. You should use only one println statement for each distinct non-blank line of the song. For example, the following line appears several times in the output, but you should have only one println statement in your program that prints that line of the song: Cat goes fiddle-i-fee. However, a method that prints a single line such as the above is not useful. Instead, you should identify groups of two or more lines that appear in multiple places in the song and create static methods that capture those groups and are called multiple times. There is a general structural redundancy to the song that you should eliminate with your static methods. Recall that methods can call other methods if necessary. The key question to ask yourself is whether or not you have repeated lines of code that could be eliminated if you structured your static methods differently

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 Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago