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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education