Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a program that uses containers, algorithms, iterators or binary trees. PLEASE CODE IN C++ and make sure the answer is like the output it

write a program that uses containers, algorithms, iterators or binary trees.

PLEASE CODE IN C++ and make sure the answer is like the output it request

PROGRAM SPECIFICATION

For this assignment, you will have collected a file of movie ratings where each movie is rated from 1 (bad) to 5 (excellent). The first line of the file is a number that identifies how many ratings are in the file. Each rating then consists of two lines: the name of the movie followed by the numeric rating from 1 to 5. Here is a sample rating file with some unique movies and the ratings:

10

Harry Potter and the Order of the Phoenix

4

Office Christmas Party

2

Harry Potter and the Order of the Phoenix

5

Rogue One: A Star Wars Story

5

The Bourne Ultimatum

3

Harry Potter and the Order of the Phoenix

4

The Bourne Ultimatum

4

Rogue One: A Star Wars Story

4

Glitter

1

Office Christmas Party

2

Write a program that reads a file in this format, calculates the average rating for each movie, and outputs the average along with the number of reviews.

Here is the desired output for the sample data:

Glitter: 1 review, average of 1 / 5

Rogue One: A Star Wars Story: 2 reviews, average of 4.5 / 5

Harry Potter and the Order of the Phoenix: 3 reviews, average of 4.3 / 5.

The Bourne Ultimatum: 2 reviews, average of 3.5 / 5

Office Christmas Party: 2 reviews, average of 2 / 5

For this assignment you will need to use a map to calculate the output. Your map(s) should index from a string representing each movies name to integers that store the number of reviews for the movie and the sum of the ratings for the movie.

Please create a driver program and make sure that your program can execute these particular test cases successfully. No credit will be given without incorporating map/pair/iterator into 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_2

Step: 3

blur-text-image_3

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 Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago