Question: This is Java . Exercise 18: Deleting Array Elements Folder name: A170 E18 Y YourFirstName Write a class DeleteElements that prints out an array and
Exercise 18: Deleting Array Elements Folder name: A170 E18 Y YourFirstName Write a class DeleteElements that prints out an array and asksthe user which number should be deleted and then deletes that number, if itexists from the array. Step 1 o Start by simply searching the element. o Pseudocode: Create an array and populate it with random positive integers. Print the array to show the user which elements the array contains. Use a WHILE loop to search the element-a WHILE loop is better than a FOR loop because you can stop when the element is found by using a Boolean value in the loop condition-and also keep track of the location where the element might be found. If the element is not found, output the error message, "Number not found. otherwise output the message, Number found at index a," where is the index where the Print out the array. o Test your program by searching: The first element in the array The last element in the array Any middle element in the array A number that is not in the array Example output: 34 65 12 76 45 39 86 71 67 Number to delete 76 Number found at index 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
