Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Randomrades) 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

image text in transcribed
image text in transcribed
(Randomrades) 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: How many grades would you like? 5 PART (A): Construct a random array. Grades: 20, 78, 54, 45, 100 PART (B): Reverse the array. Grades: 100, 45, 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. "); w/ Complete part (A) here System.out.printf("PART (B): Reverse the array. "); VI Complete part (B) here (you must call the method you wrote het System.out.printf("PART (C): Display SUM, AVG, MIN, and MAX. ") V/ Complete part (C) here } 1/ Add requested methods here }

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

More Books

Students also viewed these Databases questions

Question

2. Why?

Answered: 1 week ago

Question

1. Where do these biases come from?

Answered: 1 week ago