[Solved]Lab Practice Accessing Variables Array Determining Values Odd Finish Method Makeoddarray S Q37018147

it is for JAVA
For this lab you will practice accessing variables in an array and determining if the values are odd. You will finish the method makeOddArray. You will store only the odd values in another array and return that array. Hint: you will need to keep track of how many items you have currently put in the new array and increment that value as you add. This will keep track of your index for the new array LAB ACTIVITY 20.6.1: An Odd Array 0/4 OddArray.java Load default template… 1 import java.util.Arrays; 3 public class OddArray { 4 5 int[ makeOddArray(intl] orig, int numOdds) int[] newArr-new int[numOdds]; // new array that wil1 store only odds int currentindex 0; // to keep track of how many values are stored in your new array for indexing // TODO // End TODO returnnewArr 10 12 15 public static void main(String[] args) 16 17 18 19 20 21 /I create instance of the class OddArray OddArray odd new OddArray /I creating arrays for my oddArray method int[] iArr 2, 4, 3, 9, 11, 10, 16); int[] myArr new int[10]; /* for extra practice add ten int values to myArr using a for loop (not need to finish the assignment)/ /I TODO 23 /I End TODO 26 27 28 29 30 31 32 Itesting your method with iArr // the next line should print [3, 9, 11] note that this is not how we normally want you to print arrays System.out.println (Arrays.toString (odd.makeOddArray(iArr, 3))); // test your method with myArr /I TODO // End TODO 34 36 Show transcribed image text For this lab you will practice accessing variables in an array and determining if the values are odd. You will finish the method makeOddArray. You will store only the odd values in another array and return that array. Hint: you will need to keep track of how many items you have currently put in the new array and increment that value as you add. This will keep track of your index for the new array LAB ACTIVITY 20.6.1: An Odd Array 0/4 OddArray.java Load default template… 1 import java.util.Arrays; 3 public class OddArray { 4 5 int[ makeOddArray(intl] orig, int numOdds) int[] newArr-new int[numOdds]; // new array that wil1 store only odds int currentindex 0; // to keep track of how many values are stored in your new array for indexing // TODO // End TODO returnnewArr 10 12 15 public static void main(String[] args) 16 17 18 19 20 21 /I create instance of the class OddArray OddArray odd new OddArray /I creating arrays for my oddArray method int[] iArr 2, 4, 3, 9, 11, 10, 16); int[] myArr new int[10]; /* for extra practice add ten int values to myArr using a for loop (not need to finish the assignment)/ /I TODO 23 /I End TODO 26 27 28 29 30 31 32 Itesting your method with iArr // the next line should print [3, 9, 11] note that this is not how we normally want you to print arrays System.out.println (Arrays.toString (odd.makeOddArray(iArr, 3))); // test your method with myArr /I TODO // End TODO 34 36
Expert Answer
Answer to For this lab you will practice accessing variables in an array and determining if the values are odd. You will finish th… . . .
OR

