Create a Java Project (and package) named Lab8 Make the main class with the name Lab8_706 A local array named arr1 has been declared and initialized inside of main A local array named data2 has been declared and initialized inside of main A local array named data4 has been declared and initialized inside of main Below the main() method, write a NEW public static method named mergeIt2 with two integer array parameters and a return type of integer array Declare a local integer array and size the array to the exact length so it can hold the values from BOTH sorted input arrays Write the code to merge the sorted input arrays into the larger local array such that the data is in sorted order Return the sorted local array to the caller of the method mergeIt2 For example, if the input arrays contained 10,30 and 20,40 the method will return an array containing 10,20,30,40   Below the main() method, write a NEW public static method named median with one integer array parameter and a simple integer return type It will look at the first, middle and last items in the array parameter. Move the smallest value to the beginning, the largest to the end and the median to the middle. Return the median value of the three numbers   Inside the main() method: Declare a local variable named arr3 as an integer array Declare local variables named test1, test2 as integers Call the method mergeIt2 and pass it the parameters arr1, data2 and assign the result to arr3 Assign the value in arr3[ 1 ] to the variable test1 Assign the value in arr3[ 4 ] to the variable test2 Declare a local int variable named part_val and assign it the initial value of -1 Declare local variables named test3, test4 as integers Call the method named median, pass it the parameter data4 and assign the return value to part_val Assign the value in data4[ 0 ] to the variable test3 Assign the value in data4[ 8 ] to the variable test4 Print the message 'The method median returned ' plus the value in the variable part_val

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question

Create a Java Project (and package) named Lab8

Make the main class with the name Lab8_706

A local array named arr1 has been declared and initialized inside of main

A local array named data2 has been declared and initialized inside of main

A local array named data4 has been declared and initialized inside of main

Below the main() method, write a NEW public static method named mergeIt2 with two integer array parameters and a return type of integer array
Declare a local integer array and size the array to the exact length so it can hold the values from BOTH sorted input arrays
Write the code to merge the sorted input arrays into the larger local array such that the data is in sorted order
Return the sorted local array to the caller of the method mergeIt2
For example, if the input arrays contained 10,30 and 20,40 the method will return an array containing 10,20,30,40
 

Below the main() method, write a NEW public static method named median with one integer array parameter and a simple integer return type
It will look at the first, middle and last items in the array parameter. Move the smallest value to the beginning, the largest to the end and the median to the middle.
Return the median value of the three numbers
 

Inside the main() method:
Declare a local variable named arr3 as an integer array
Declare local variables named test1, test2 as integers

Call the method mergeIt2 and pass it the parameters arr1data2 and assign the result to arr3
Assign the value in arr3[ 1 ] to the variable test1
Assign the value in arr3[ 4 ] to the variable test2

Declare a local int variable named part_val and assign it the initial value of -1
Declare local variables named test3, test4 as integers

Call the method named median, pass it the parameter data4 and assign the return value to part_val
Assign the value in data4[ 0 ] to the variable test3
Assign the value in data4[ 8 ] to the variable test4

Print the message 'The method median returned ' plus the value in the variable part_val

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 7 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,