Question: Write a program called LoopyMelody in your mmw package that will 1 . accept, from the standard input stream, data corresponding to the number of
Write a program called LoopyMelody in your mmw package that will accept, from the standard input stream, data corresponding to the number of notes per line of melody and number of pitches to shift up from middle A allow for a random shift relative to middle A print, to the standard output stream, the resulting melody while using a while loop. In addition to the above description, the melody that you are to create has a rigid structure that is more thoroughly described in the leading comment of the code provided. Your programs output should be consistent with the following demoes, which you should study to understand the structure of the melody. Pay special attention to the alignment of the userentered input and the prompts. run : Enter the number of notes per row melody : Enter the shift above middle A or for a random shift : Here s your melody C C C C A C C C A D C C A D E C A D E F E D E F G C E D E F C C E D E C C C E D C C C C E E run : Enter the number of notes per row melody : Enter the shift above middle A or for a random shift : Here s your melody F F F D F F D G F D G A A G A B F A G A F F A G F F F A A run : Enter the number of notes per row melody : Enter the shift above middle A or for a random shift : Here s your melody G G G G G E G G G G E A G G G E A B G G E A B C G E A B C D B A B C D E G B A B C D G G B A B C G G G B A B G G G G B A G G G G G B B Moreover, your program should be consistent with the following Java program text and the iteration should be done with while loops only. What I did was to write the program, and then delete the bodies of some of the methods. Your job is to add the instructions back. Or at least, instructions that will do the job and utilize while loops. Other than adding instructions in the indicated methods, all of the executable code should remain exactly as in the accompanying program text. which means that you are free to add comments to yourself as needed. You should Daniel Schlegel & Elizabeth Wilcox Reproduction prohibited without author consent CSCSC Programming Challenge # Fall be able to use your program to generate the melodies that appear in my demo, and many others, as well. Program to create an iterative melody The lines start out playing the same baseline pitch for duration with a two pitch shift note lowered at first Over the lines the constant baseline pitch is played fewer times and more and more rising pitches are played Then only the shift note now two pitches higher is played along with the rising pitch melody Lastly the constant baseline pitch starts to make its return with the rising pitch melody subsides In this part the shift note is also two pitches higher than the baseline pitch The melody ends with the shift note played for a duration of beats The number of notes in each line is read from the standard input stream and the initial pitch is either read from the standard input stream as a pitch shift or randomly selected from or package mmw ; import note SNote ; import java util Scanner ; public class LoopyMelody public static void main String args
