Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that will remove a random integer (between 0-6) from an array co

ID: 3734019 • Letter: W

Question

Write a program that will remove a random integer (between 0-6) from an array containing random integers (between 0-6). This program must use four methods to accomplish this:

       a. Create a method to build the array of random integers between 0-6. The array must be size 10.

       b. Create a method to generate the random integer between 0-6.

       c. Create a method called remove(int v, int[] in) that will return a new array of the integers in the given array but with the value v removed. For example, if v is randomly generated as 3 and in contains 0,1,3,4,6,5,3,1,3,6 the method will return an array containing 0,1,4,6,5,1,6.

       d. Create a method to print the original array, the number that is to be removed, and the new array.

                     i.e. “The original array contained: 0,1,3,4,6,5,3,1,3,6.”

                             “The number requested to be removed is 3.”

       “The new array contains: 0,1,4,6,5,1,6.”

*Keep in mind that because we are dealing with random numbers, it is possible that the random number you generate to be removed from the array, will not exist in the array. In this case, your output should look like:

i.e. “The original array contained: 0,1,3,4,6,5,3,1,3,6.”

          “The number requested to be removed is 2.”

          “The new array contains: 0,1,3,4,6,5,3,1,3,6.”

Explanation / Answer

import java.util.Random; import java.util.Scanner; public class Output1 { public static int[] generateRandom(int[] myArray) { int min = 0, max = 6; int range = (max - min) + 1; //fill the array for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote