Code: public class RURottenTomatoes { public static void main (String[] args) { int r = Integer.parseInt(args[0]); int c = Integer.parseInt(args[1]); for ( int i = 0; i < args.length; i++ ) { int[][] array = new int[r][c]; } String input = args[0]; int n = input.length(); String temp; int arrayR = r; int arrayC = c; for ( int i = 0; i < r; i++ ) { temp = input.substring( i, i + 1 ); arrayR = arrayR + Integer.parseInt(temp); for ( i = 0; i < c; c++ ) { temp = input.substring( i + 1, i + 2 ); arrayC = arrayC + Integer.parseInt(temp); } } } } I did all this, but then stuck. I have no idea what to do next, and I think my code is wrong. Can you help me out doing this assignment? Please explain everything that you do
Code: public class RURottenTomatoes { public static void main
(String[] args) { int r = Integer.parseInt(args[0]); int c = Integer.parseInt(args[1]); for ( int i = 0; i < args.length; i++ ) { int[][] array = new int[r][c]; } String input = args[0]; int n = input.length(); String temp; int arrayR = r; int arrayC = c; for ( int i = 0; i < r; i++ ) { temp = input.substring( i, i + 1 ); arrayR = arrayR + Integer.parseInt(temp); for ( i = 0; i < c; c++ ) { temp = input.substring( i + 1, i + 2 ); arrayC = arrayC + Integer.parseInt(temp); } } } } I did all this, but then stuck. I have no idea what to do next, and I think my code is wrong. Can you help me out doing this assignment? Please explain everything that you do clearly! The instructions are below: RU Rotten Tomatoes. Write program RURottenTomatoes.java that creates a 2 dimensional integer array of movie ratings from the command line arguments and displays the index of the movie that has the highest sum of ratings. Ratings range from 1 to 5 (inclusive). The rows of the 2D array correspond to movie reviewers and the columns of the 2D array correspond to movies. The reviewer at index 2 gave movie at index 0 a rating of 4. Take a look at the following example for an explanation on the command line arguments sequence. Note 1: assume that the order of the first two input arguments are the number of rows and the number of columns. Note 2: assume that there are enough arguments to completely fill the 2D array. Note 3: if multiple movies have the same highest sum of ratings, display the movie with the lowest index. DO NOT use System.exit() DO NOT add any import statements DO NOT add the project or package statements DO NOT change the class name DO NOT change the headers of ANY of the given methods DO NOT add any new class fields ONLY print the result as specified by the example for each problem. DO NOT print other messages, follow the examples for each problem.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images