Write a static method called rateMovies
that takes a Scanner
containing movie ratings as a parameter, and prints statistics about each movie. The input will have one movie entry per line. Each line has an integer n indicating how many ratings there are, followed by the n different ratings for the movie. Each line ends with the title of the movie. For example, the input might contain the following:
4 9.2 9 8.5 9.5 Seven Samurai (1954)
5 8.2 9.5 7 10 9.8 12 Angry Men (1957)
6 5.7 6 9 9 8 10 Fight Club (1999)
The method should read each line of the file, printing one line of output for each movie entry. Each line of output should list the movie title, the number of ratings, and the score (the average of the ratings). For the input above, it should produce the following output:
title = Seven Samurai (1954), ratings = 4, score = 9.05
title = 12 Angry Men (1957), ratings = 5, score = 8.9
title = Fight Club (1999), ratings = 6, score = 7.95
You are to exactly reproduce the format of this output. You may assume that the number of ratings is always at least 1.