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

remember tou MUST have a class and a Demonstration program Caldwell Cinemax inco

ID: 3667481 • Letter: R

Question

remember tou MUST have a class and a Demonstration program

Caldwell Cinemax incorporated recently received reviews from 4 credible sources for movies it is currently showing. The rating are listed in order by reviewer. Rating Chart: poor -1, fair -2, Good-3, Excellent -4.

The data obtained is as follow:

45 Years - 1,22,1

Concussion - 3,3,4,3

Airlift - 4,4,3,3

Hail Caesae - 2,1,1,1,

You should write a program using one and two dimensional arrays to answer the following questions;

1. How many movies were reviewed?

2. What was the over all average movie rating for the movies shown by caldwell cinemax

3. What were the names of the movies which scored above the average rating?

4. What was the average rating for each reviewer?

Explanation / Answer

package movie_Rating;

import java.io.InputStreamReader;
import java.util.Scanner;

public class Movie_Ratings {
   
public static void main(String[] args) {
        String ans;
    Scanner sc=new Scanner(System.in);
String dataAnalysis[][]=new String[10][20];       
System.out.println("Enter the Data");
int i=0,j=0;

do
{
    dataAnalysis[i++][0]=sc.nextLine();
    System.out.println("do you want to add more reviews");
    ans=sc.next();
}while(ans=="y");

System.out.println("Enter the ratings");

do
{
    dataAnalysis[j][1]=sc.nextLine();
    dataAnalysis[j][2]=sc.nextLine();
    dataAnalysis[j][3]=sc.nextLine();
    dataAnalysis[j][4]=sc.nextLine();
}while(j<=i);

System.out.println("Number of movies reviewd are "+i);

System.out.println("Overall Average rating");
int total_rating=0;
for (int k = 0; k < i; k++) {
    for (int k2 = 1; k2 < 4; k2++) {
        total_rating+=Integer.parseInt(dataAnalysis[k][k2]);
    }
}

double avg_rating=total_rating/(4*i);

System.out.println("Average Rating is "+avg_rating);

    }

}