Question: 1. Create a program that will remove the duplicate elements of a given array and return the new length of the array. Ask the

1. Create a program that will remove the duplicate elements of a 

1. Create a program that will remove the duplicate elements of a given array and return the new length of the array. Ask the user on how many elements he/she wants to have in the array. 2. Name your class as Activity4A and save it as Activity4A.java. 3. Sample output is illustrated below. Sample output 1. Enter the number of elements: 5 Sample output 2. Enter the number of elements: 10 Enter value for num[1]: 29 Enter value for num[2]: 36 Enter value for num[3]: 29 Enter value for num[4]: 30 Enter value for num[5]: 98 The inputted values are 29, 36, 29, 30, 98, Duplicate values 29 The new values of the array are 29, 36, 30, 98 The new length of the array is 4 Enter value for num[1]: 29 Enter value for num[2]: 36 Enter value for num[3]: 29 Enter value for num[4]: 30 Enter value for num[5]: 98 Enter value for num[6]: 98 Enter value for num[7]: 29 Enter value for num[8]: 29 Enter value for num[9]: 1 Enter value for num[10]: 2 The inputted values are 29, 36, 29, 30, 98, 98, 29, 29, 1,2 Duplicate values 29, 98 The new values of the array are 29, 36, 30, 98, 1, 2 The new length of the array is 6 Activate Go to Settim

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 Programming Questions!