Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MovieRatingsTest.java public class MovieRatingsTest { public static void main(String args[]) { String[] movies = {Gravity, 12 Years a Slave, Spaceballs}; String[] reviewers = {Jen, Bino,

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

MovieRatingsTest.java

public class MovieRatingsTest { public static void main(String args[]) { String[] movies = {"Gravity", "12 Years a Slave", "Spaceballs"}; String[] reviewers = {"Jen", "Bino", "Sophia"}; MovieRatings ratings = new MovieRatings(reviewers, movies); //give some values for the ratings for(int i = 0; i

Create a program to store and process movie ratings. Use a 2D array to store ratings by different reviewers for different movies. Each row represents a different movie and each column represents a different reviewer. There will also be two separate arrays to store the names of movies and the names of the reviewers. You may use the atached t test program MovieRatings ratingsI:int reviewersll String movies]: String +MovieRatings(reviewersI: String, moviesl String) getAvgRating:double +getAvgRatingbyMovie movielndex:int): double + getAvgRatingbyReviewer(reviewerlndex:int):double + getMovielndex(movieName: String):int +getReviewerlndex(reviewerName:String):int +setRating(movielndex:int, reviewerlndex:int, rating:int):void + printMovieRatingsmovielndex:int):void + printReviewerRatings reviewerlndex:int):void MovieRatings() - Constructor for the class One parameter is an array of reviewers names One parameter is an array of movie names Description: set the parameters equal to the private data members for the movies and reviewers, initialize the 2D ratings array based on the size of the reviewers array (rows) and the size of the movies array (columns) . getAvgRating0 Returns a double value representing the average rating Description: Find the average rating for all movies and all reviewers (ie all data in the table) getAvgRatingsbyMovie) One parameter, the index of the movie to find all the reviews for - Returns a double value representing the average rating Description: Find the average rating for a single movie (i e. one column representing all the reviewers scores for that one movie) getAvgRatingsbyReviewer) One parameter, the index of the reviewer to find all the reviews for Returns a double value representing the average rating Description: Find the average rating for a single reviewer (Le-one row representing all the movies for that one reviewer) getMovielndex0 . One parameter, the name of the movie e Returns an integer representing the index number of that movie Description: Searches the movies array to find the index location for that movie. This can then be used to find the ratings for that movie in the ratings 2D array . getReviewerlndex(0 One parameter, the name of the reviewer Returns an integer representing the index number of that reviewer Description: Searches the reviewers array to find the index location for that reviewer This can then be used to find the ratings for that reviewer in the ratings 2D array setRating0 One parameter each for the movie index, for the reviewer index and for the rating to store Description: the reviewer index specifies the row, the movie index specifies the column and the rating is the value to store in that cell printMovieRatings0 One parameter that represents the index of the movie name and the movie ratings a Description: prints the movie name and the ratings to System.out Example: "The Lego Movie: 5, 6, 2,7,8 printReviewerRatings0 One parameter that represents the index of the reviewers name and their movie ratings Description: prints the reviewer name and the ratings to System.out Example: "Roger Ebert: 4, 2, 8, 9

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago