Question: The instructions for the code are below. I work on the code but it does not output the exact one. The output for line 2

The instructions for the code are below. I work on the code but it does not output the exact one. The output for line 2 and 4 are the ones that are outputting different. What is wrong with the code?

Guidelines with Code:

The instructions for the code are below. I work on the code

Code with output:

but it does not output the exact one. The output for line

You are given an integer array (arr) declared in the program. Count all the numbers that are repeated in the array entries. If there are no duplicates then your program should output should print out according to the expected output below. If there is only one duplicate then the message should state that. Finally, for two or more duplicates then the output should match the expected output. Your solution should use loops (hint: nested loops) and should work for any integer array. Expected Output: There are no duplicates with value 1 beyond index There are 3 more occurrences of value 2 starting at index 1 There are 2 more occurrences of value 2 starting at index 2 There are 2 more occurrences of value 3 starting at index 3 There is only 1 more occurrence of value 4 starting at index 4 There is only 1 more occurrence of value 2 starting at index 5 There are no duplicates with value 4 beyond index 6 There is only 1 more occurrence of value 3 starting at index 7 There are no duplicates with value @ beyond index 8 There are no duplicates with value 5 beyond index 9 There are no duplicates with value 3 beyond index 10 There are no duplicates with value 2 beyond index 11 21 #9999 6- Quick Access H@ @ *Find DuplicateCount.java X ** 2 public class FindDuplicateCount {| public static void main(String[] args) { int[] arr = {1, 2, 2, 3, 4, 2, 4, 3, 0, 5, 3, 2}; int i = 1; int i; int count = 0; for (i = 0; i Find DuplicateCount (Java Application] /Library/Java/JavaVirtual Machines/jdk1.8.0_221.jdk/Contents/Home/bin/java (Jan 30, 2020, 12:44:25 PM) There are no duplicates with the value 1 beyond index 0 There are 2 more occurrences of value 2 starting at index 1 There are 2 more occurrences of value 2 starting at index 2 There are 3 more occurrences of value 3 starting at index 3 There is only 1 more occurrence of value 4 starting at index 4 There is only 1 more occurrence of value 2 starting at index 5 There are no duplicates with the value 4 beyond index 6 There is only 1 more occurrence of value 3 starting at index 7 There are no duplicates with the value o beyond index 8 There are no duplicates with the value 5 beyond index 9 There are no duplicates with the value 3 beyond index 10 There are no duplicates with the value 2 beyond index 11 Writable Smart Insert 28:2

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!