Write the code to complete a method writeScoresToFile() as d…

Write the code to complete a method writeScoresToFile() as defined below. This method receives a double ArrayList called scoreData and a String representing the name of the file to write to, such as output.txt. The method opens the file for writing and writes each score from the scoreData list to a new line in the file. After writing all the scores, the method prints a confirmation message to the console in the following format: Successfully wrote 5 scores to output.txt Use a try/catch block to catch an IOException. If an exception occurs, output the exception message to the console. For example, if the scoreData ArrayList contains: And the file name is output.txt, the file should contain: 87.5 92.0 76.25 81.75 94.5 Code submitted in the text box supplied must include the complete method signature and body, using the correct data types and file I/O operations based on the problem statement.