Question
Part 1. Create a Java program with the following methods with integer arrays: Array ar with 12 integer numbers a) arRandom to fill in an
Part 1.
Create a Java program with the following methods with integer arrays:
Array ar with 12 integer numbers
a) arRandom to fill in an array with integer numbers from start to end numbers
Inside the method program the case if the user put the start number bigger than end number. (Swap them before populating the array with random numbers).
b) arPrint to print an array in a row
c) arAverage to print the average of an array
d) arMin - to find and return min element in an array
e) arSearch to output if a number is in an array 0r not
Before creating the methods please analyze which type of method to write (void or method that returns a value), number of all parameters and their types. Create a method header for each method.
In the main method: declare an array ar with 12 int elements. Ask the user for start and end numbers. Use methods above to populate the array and print it. Then find and output min element.
Ask the user for a number to search and call the method arSearch.
Part 2 .(In the same program)Create a method arMerge with 3 int array parameters a, b and c. Method should populate the array c with numbers: first part from array a, second part -> from b. In the main method create one array a with 9 elements and put their random integers from 10 to 50. Then create the array b with 6 int elements from 1 to 8. Declare the array c with 15 int elements. Call method arMerge and then print all 3 arrays by calling 3 times arPrint method.
Put the header for your program and put the appropriate headers for each method. Submit your work by Google Classroom.
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