Question: NEED HELP FIXING MY CODE SO IT LOOK LIKES THE EXPECTED OUTPUT. LANGAUGAE IS JAVA. In this lab you will practice using for loops with



NEED HELP FIXING MY CODE SO IT LOOK LIKES THE EXPECTED OUTPUT. LANGAUGAE IS JAVA.
In this lab you will practice using for loops with arrays and comparing double values, using a threshold, to see if two sets of numbers are the same. Background Reading ZyBooks Chapter 5 Task The first comment of your main method should be your identification comment: .//Lab5b. [Namej You will need to then: Create and populate the two sets of double values, in which the number of elements and the elements themselves are specified by the user. (i.e. the user will state how many numbers are in the first set, give the values for that set and then move on to the second set of numbers) iterate through the sets and compare the values. For the purposes of this lab, we will say that the order matters in determining if the sets are the same. (HINT: This also means that the lengths of the arrays must be the same). If the arrays are the same in both length and values, print set one and set two are equal. Otherwise, print set one and set two are not equal Comparing double values using a threshold Recall that floating-point numbers may differ in a very small value. For example, 1.0 might actually be stored as 0.9999999...or .0000000002. When comparing these values, we often use a "tolerance" level that says, "if the difference is smaller than some amount, then it is negligible and the numbers can be thought of as the same. We can achieve this by comparing the absolute value of the difference of the elements to the tolerance. For example, if Math.abs arrayl [0] - array210]>0.001 System.out.println ("The values of arrayl [0] and array2[0] are not equal")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
