Question: Solve this in java please! 6.7 Close Enough Two arrays are equal when they have the same length and have the same value at each

Solve this in java please!

Solve this in java please! 6.7 Close Enough Two arrays are equal

when they have the same length and have the same value at

each corresponding index. We'll say that two arrays are close enough when:

1. Values at corresponding indexes differ by an amount under some definedthreshold; and 2. If one array is longer than the other, we

6.7 Close Enough Two arrays are equal when they have the same length and have the same value at each corresponding index. We'll say that two arrays are close enough when: 1. Values at corresponding indexes differ by an amount under some defined threshold; and 2. If one array is longer than the other, we ignore the "extra" values in the longer array Here are a few examples: To determine whether 2 arrays are close enough, you will implement 2 distinct methods: 1. Implement the absDiffs IgnoreExtras method to accept 2 int arrays as input and return an array of the absolute differences of the values at corresponding indexes, ignoring any extra elements in the longer input array. Several examples are given below. 2. Implement the al LAtOrUnder method to accept an int threshold and an int array as inputs and return whether every value the input array is less than or equal to the threshold. Several examples are given below. Read the provided main method code to understand the program overall, then finish the program: 1. Implement a stub for absDiffsIgnoreExtras and a stub for al LAtOrUnder (meaning implement the method headers and simple return statements for each method) 2. Submit and ensure you pass the stub tests (most or all of the other tests will fail) 3. Complete the implementation for absDiffsIgnoreExtras 4. Complete the implementation for allAtOrUnder Hint: In step \#3, make use of the Math. abs(x) method, which accepts the number x as input returns the absolute value of x. 459534.2193308.q3zqy7 6.7.1: Close Enough 0/120 CloseEnough.java Load default template... Run your program as often as you'd like, before submitting for grading. Below, type any needed innut values in the first box. then click Run proaram and observe the proaram's outbut in the CloseEnough.java Load default template... int [] absDiffs = absDiffsIgnoreExtras(nums1, nums 2); System.out.println("absDiffs: " Arrays.toString(absDiffs)); System.out.print(" Threshold: "); int threshold = Integer.parseInt(console.nextLine()); boolean closeEnough = allAtOrUnder(threshold, absDiffs); if (!closeEnough) System.out.print("not "); \} System.out.println("close enough!"); Il Code goes here Il do not change the code below here, but read it to understand what it is doing public static int[] getUserInputAsIntArray(Scanner console) \{ String input = console nextLine() String [] data = input.split(" "); int [] nums = new int [ data. length ]; for (int i=0;i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!