Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider a list of movie reviews you have compiled, where each movie receives a rating from 1 (bad) to 5 (excellent.) The first line in

Consider a list of movie reviews you have compiled, where each movie receives a rating from 1 (bad) to 5 (excellent.) The first line in the file is the number of ratings that are in that particular file. After that each rating consists of two lines:

-the name of the movie

-the numeric rating between 1 to 5

Here is a sample file with four unique movies and seven ratings:

7

Harry Potter and the Half-Blood Prince

4

Harry Potter and the Half-Blood Prince

5

Army of the Dead

1

Harry Potter and the Half-Blood Prince

4

Army of the Dead

2

The Uninvited

4

Pandorium

3

For this exercise, you are to write classes which will read in a file in the above format, calculate the average rating for each movie, and the output the average along with the number of reviews. Using the input file from above, sample output can be shown as follows:

Harry Potter and the Half-Blood Prince: 3 reviews, average of 4.3 / 5

Army of the Dead: 2 reviews, average of 1.5 / 5

The Uninvited: 1 review, average of 4 / 5

Pandorium: 1 review, average of 3 / 5

Ensure to use an instance (or instances) of the class HashMap in your solution. Your map should index from a string representing each movies name to integers that store the number of reviews for the movie, as well as the sum of ratings for the movie. Feel free to name the source code files anything to your liking when completing the solution.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions