Question
PLEASE MAKE SURE THE CODE RUN CORRECTLY PLEASE. Create a Java class called TotalArray that sums the value of an array. This class should have
PLEASE MAKE SURE THE CODE RUN CORRECTLY PLEASE.
Create a Java class called TotalArray that sums the value of an array. This class should have a main method, sumArray method, and createRandomArray method.
The main method should accept the size of an array and a bound from the user and print the random array and the sum of the random array.
The createRandomArray should create an array of random numbers. This method should accept the size of an array and a bound. The method should return an array of random numbers.
The sumArray method should calculate the sum of a random array. This method should accept a random array generated by the createRandomArray method and return the sum of the array
Note: All method calls should be done in the main.
An example of the program input and output is shown below:
Enter an array size: 10
Enter a bound: 10
The random array is [2, 4, 6, 2, 9, 1, 4, 5, 5, 6]
The sum of the random array is 44
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started