Question: In java please, The java program should read lyrics from a file found in the same directory as the program. It The program should read

In java please,

The java program should read lyrics from a file found in the same directory as the program. It The program should read the lyrics for each line and treat each word as a token. Embedded in each line will be the line number for that line. The number may occur anywhere within the line and each line is guaranteed to have one number in it. The program should read each line, remove the integer within the line and put the integer into one array. For all the words that occur in the line, put them into a separate String array. After reading all the lines, use the Selection Sort algorithm that sorts the two arrays in parallel. After sorting all the lines, display the lyrics in order corresponding to the number embedded within each line. The output should have the first character of the first word at the beginning of the line. The output should contain one space between each word. A word is a continuation of characters until it reaches a space.

Vivir mi 6 vida, la la la la Voy a reir, voy a 3 gozar A veces llega 9 la lluvia Voy a reir, 1 voy a bailar 10 Para limpiar las heridas Vivir mi vida, 2 la la la la Voy a reir, 7 voy a gozar Vivir mi vida, 8 la la la la 4 Vivir mi vida, la la la la Voy 5 a reir (Ay eso!), voy a bailar

So the program should print to the screen the following:

Voy a reir, voy a bailar Vivir mi vida, la la la la Voy a reir, voy a gozar Vivir mi vida, la la la la Voy a reir (Ay eso!), voy a bailar Vivir mi vida, la la la la Voy a reir, voy a gozar Vivir mi vida, la la la la A veces llega la lluvia Para limpiar las heridas
  1. If the file does not exist, then the program should instead display, File not found and exit.
  2. If the lyrics.txt contains more than 200 lines, it should display, The song is too long and exit.
  3. If the lyrics file is empty, the program should display, Empty file and exit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!