We’d love to hear any feedback or comment from you!

###### Engineering · Computer Science
Question details

PLEASE COMPLETE THE LAB FOLLOWING THE GIVEN GUIDELINES (MAKE SURE IT OUTPUTS CORRECTLY

/***
*
* Complete the static methods below to perform some basic array tasks
*
* Below is the expected output
*
* ---array example 1---
* 4, 5, 9, 7, 3, 4, 8
* The largest value is: 9
* The smallest value is: 3
* In order: false
*
* ---array example 2---
* 24, 87, 96, 102, 874, 941
* reverse order: 941, 874, 102, 96, 87, 24
* In order: false
*
* ---array example 3---
* 2, 6, 8, 9
* 1, 3, 7, 9, 10
* merged array: 1, 2, 3, 6, 7, 8, 9, 9, 10
* In order: true
*
****/
public class ArrayBasics {
/*** <<< CODE NOT COMPLETE >>>
* prints out an array of any size
***/
public static void print(int[] a) {
// <<< COMPLETE THE CODE >>>
}
/*** <<< CODE NOT COMPLETE >>>
* returns the largest integer in an array
***/
public static int max(int[] a) {
// <<< COMPLETE THE CODE >>>
}

/*** <<< CODE NOT COMPLETE >>>
* returns the smallest integer in an array
***/
public static int min(int[] a) {
// <<< COMPLETE THE CODE >>>
}
/*** <<< CODE NOT COMPLETE >>>
* returns boolean true if the array is in sorted order
* else returns false
***/
public static boolean inOrder(int[] a) {
// <<< COMPLETE THE CODE >>>
}

/*** <<< CODE NOT COMPLETE >>>
* reverses the order of the elements in the array
***/
public static void reverse(int[] a) {
// <<< COMPLETE THE CODE >>>
}
/*** <<< CODE NOT COMPLETE >>>
* merges two sorted arrays into 1 new array, maintains the sorted order
***/
public static int[] merge(int[] a, int[] b) {
// <<< COMPLETE THE CODE >>>
}

/***
* The main method is complete.
*/

public static void main(String[] args) {
System.out.println("\n---array example 1---");
int num1[] = {4,5,9,7,3,4,8};
print(num1);
System.out.println("The largest value is: " + max(num1));
System.out.println("The smallest value is: " + min(num1));
System.out.println("In order: " + inOrder(num1));
System.out.println("\n---array example 2---");
int num2[] = {24,87,96,102,874,941};
print(num2);
System.out.print("reverse order: ");
reverse(num2);
print(num2);
System.out.println("In order: " + inOrder(num2));
System.out.println("\n---array example 3---");
int num3[] = {2,6,8,9};
int num4[] = {1,3,7,9,10};
print(num3);
print(num4);
System.out.print("merged array: ");
int merged[] = merge(num3,num4);
print(merged);
System.out.println("In order: " + inOrder(num3));

}

}