In the following program skeleton, replace <Insert code here.> with your own code. Hint: Use the variables that are already declared for you (songs, searchText, foundIndex, and count). The resulting program should prompt the user for a search string and then display the number of occurrences of the search string in a given list of songs. Study the sample session.
import java.util.Scanner;public class CountSubstringOccurrences{public static void main(String[] args){Scanner stdIn = new Scanner(System.in);String songs ="1. Green Day - American Idiot\n" +"2. Jesus Jones - Right Here, Right Now\n" +"3. Indigo Girls - Closer to Fine\n" +"4. Peter Tosh - Equal Rights\n";String searchText; // text that is searched forint foundIndex; // position of where text is foundint count = 0; // number of occurrences of search textSystem.out.print("Enter search text: ");searchText = stdIn.nextLine();System.out.println("Number of occurrences of \"" +searchText + "\": " + count);} // end main} // end class CountSubstringOccurrences Sample session:
Enter search text: RightNumber of occurrences of "Right": 3
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.