Question: Random grades 1 and 2: (RandomGrades) Using built-in arrays, create the program and associated methods described below. Part A: Using the random method in the

Random grades 1 and 2:
Random grades 1 and 2: (RandomGrades) Using built-in arrays, create the program
and associated methods described below. Part A: Using the random method in
the Math class, create a program that creates an array of specified

(RandomGrades) Using built-in arrays, create the program and associated methods described below. Part A: Using the random method in the Math class, create a program that creates an array of specified size comprised of random integer grades from 0..100. Then display the grades in the order they appear in the array. Part B: Write a method reverseArray(x) that will reverse the elements of array x. Then display the reversed array. Your method must physically reverse the array not simply display them in reverse order. Part C: Write four (4) additional methods, sum (x), average (x),min(x), and max (x) that will return the sum, average, minimum element, and maximum element from array x, respectively. All should have return type int except average which should return a double. Your main program should call these methods to display the resulting values for the random array selected in part A. Sample Output: 78, 45, How many grades would you like? 5 PART (A): Construct a random array. Grades: 20, 54, 45, 100 PART (B): Reverse the array. Grades: 100, 54, 78, 20 PART (C): Display SUM, AVG, MIN, and MAX. Sum of grades - 297 Average of grades = 59.40 Minimum grade 20 Maximum grade 100 (RandomGrades 2) Using an ArrayList, create the program and associated methods that duplicates the behavior of RandomGrades above. Random Grades X Compile Undo Cut Copy Paste Find... Close Source Code */ import java.util.*; public class RandomGrades { public static void main(String[] args) { Scanner console = new Scanner(System.in): int numGrades; System.out.printf("How many grades would you like? "); numGrades = console.nextInt(); System.out.printf("PART (A): Construct a random array. "); // Complete part (A) here System.out.printf("PART (B): Reverse the array. "); // Complete part (B) here (you must call the method you wrote here System.out.printf("PART (C): Display SUM, AVG, MIN, and MAX. "); // Complete part (C) here } // Add requested methods here */ import java.util.*; public class RandomGrades2 { public static void main(String[] args) { Scanner console = new Scanner(System.in); int numGrades; System.out.printf("How many grades would you like? "); numGrades = console.nextInt(); System.out.printf("PART (A): Construct a random array. "); w/ Complete part (A) here System.out.printf("PART (B): Reverse the array. "); 1/ Complete part (B) here (you must call the method you wrote here System.out.printf("PART (C): Display SUM, AVG, MIN, and MAX. "); w/ Complete part (C) here > // Add requested methods here >

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!