njit2.mrooms.net 14. You have collected reviews from four movie reviewers where
ID: 3698537 • Letter: N
Question
njit2.mrooms.net 14. You have collected reviews from four movie reviewers where the reviewers are numbered 0-3. Each reviewer has rated six movies where the movies are numbered 100-105. The ratings range from 1 (terrible) to 5 (excellent). The reviews are shown in the following table: 100 101 102 103 1041 Write a program that stores this data using a 2D array. Based on this information your program should allow the user to enter ratings for any three movies. The pro- gram should then find the reviewer whose ratings most closely match the ratings input by the user. It should then predict the user's interest in the other movies by outputting the ratings by the reviewer for the movies that were not rated by the user. Use the Cartesian distance as the metric to determine how close the reviewer's 2.Explanation / Answer
#include<iostream>
using namespace std;
class Movie_Rewiew{
int MR[4][6];
public:
Movie_Rewiew()
{
int i,j;
cout<<"Enter the review of reviewer of movies 100 to 105 ";
cout<<" ";
for(i=0;i<6;i++)
cout<<i+100<<" ";
for(i=0;i<4;i++)
{
cout<<endl<<i<<" ";
for(j=0;j<6;j++)
cin>>MR[i][j];
}
}
void acceptreview()
{
int i,j,a[3],b[3],min=1000, index=-1,val=0;
bool flag[6];
for(i=0;i<6;i++)
flag[i]=0;
cout<<"Enter the three movies and its review ";
for(i=0;i<3;i++)
{
cout<<" Movie:";
cin>>a[i];
a[i]=a[i]-100;
flag[a[i]]=1;
cout<<"review:";
cin>>b[i];
}
for(i=0;i<4;i++)
{
for(j=0;j<3;j++)
val+=(MR[i][a[j]]-b[j])*(MR[i][a[j]]-b[j]);
if(min>val)
{
min=val;
index=i;
}
val=0;
}
cout<<"Rating of others Movies are: ";
for(i=0;i<6;i++)
if(flag[i]==0)
cout<<" Review:"<<MR[index][i]<<" Movie:"<<i+100;
}
};
int main()
{
Movie_Rewiew mr;
mr.acceptreview();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.