Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You have recently collected reviews from four movie reviewers where the reviewer

ID: 3540519 • Letter: Y

Question

You have recently collected reviews from four movie reviewers where the reviewers are numbered 1-4.  Each reviewer has rated six movies where the movies are numbered 100-105.  The ratings range from 1 (terrible) to 5 (excellent).  Note: To store the sample data below in a 2D array the reviewer numbers must be mapped to 0-3 (row indexes) and the movie ID%u2019s must be mapped to 0-5 (column indexes).  The movie rating does not include data for unrated movies and only includes values related to the rating range provided. A sample data set with

movie review ratings are shown in the following table:

Based on this information your program should allow the user a menu of 6 options. The options are:

*If a reviewer has rated multiple movies with the same highest rating, display all the movie numbers with the same highest rating in your output (this maybe on a single line or on multiple lines and would depend on how you have written the procedure in the function that is called for option#3). Points will not be deducted if it does not match the sample output below, but I must see all the movie numbers listed if there are multiple movies with the same highest rating.

INPUT VALIDATION: Prevent out of bound array access. For example with menu option#3 limit the user input to reviewer#1-4 and similarly with menu option#4 limit the user input to movie# 100-105. With menu option#5 limit the data entry for ratings to 1-5.

Here is a sample run of the program that you may use as a guide in helping set-up the interface and also provides a few check figures...

If your program does not compile, it will not be graded.  HINT: I am thinking six to seven two dimensional array processing functions with procedures or algorithms that address the menu choice should be adequate. When working with the array processing in your functions watch for "Off-By-One Errors".
Use a do while loop with a switch statement as shown above. You should call the relevant functions from each case.  Compile your code often. Only write a small portion of code, let's say a single function for a specific menu option, check that it still compiles before moving on. This way when you get a syntax error, you can be fairly certain the error is in the part you just wrote.

100 101 102 103 104 105 1 3 1 5 2 1 5 2 4 2 1 4 2 4 3 3 1 2 4 4 1 4 5 1 4 2 4 2

Explanation / Answer

#include<iostream>

#include<iomanip>

#include<cmath>

using namespace std;


const int num_cols = 7;

const int num_rows = 5;


void showarray(int [][num_cols],int);


int main ()


{

int x,y,z,x1,y1,z1;


int table1[num_rows][num_cols] = {{0,100,101,102,103,104,105},

{0,3,1,5,2,1,5},

{1,4,2,1,4,2,4},

{2,3,1,2,4,4,1},

{3,5,1,4,2,4,2}};


cout<<"The array looks like this "<<endl;

showarray(table1,num_rows);


cout<<"Please enter the movie you would like to rate "<<endl;

cin>>x;

cin>>y;

cin>>z;

cout<<"please enter a rating for your movies "<<endl;

cout<<x;

cin>>x1;

cout<<y;

cin>>y1;

cout<<z;

cin>>z1;



system("Pause");

return 0;

}


void showarray(int array[][num_cols], int num_rows)

{

for(int row =0; row < num_rows; row++)

{

for(int col = 0; col < num_cols; col++)

{

cout<<setw(5)<<array[row][col]<< " ";

}

cout<<endl;

}

}


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote