Question: Write a Java program that creates a string array by getting the capacity and elements from the user. After creating the array, read another

Write a Java program that creates a string array by getting the capacity and elements from the user. After

Write a Java program that creates a string array by getting the capacity and elements from the user. After creating the array, read another string from the user and search it through the array. If that string exists in the array, print the element number of that string. If no match is found, display "Word not found in the array" message. Sample Output: Enter the capacity of the array: Enter the element 1 of the array: ted Enter the element 2 of the array: university Enter the element 3 of the array: computer Enter the element 4 of the array: engineering Enter the word to be searched in the array: computer Word computer is found in the array and it is element 3! Enter the capacity of the array: 3 Enter the element 1 of the array: java Enter the element 2 of the array: array Enter the element 3 of the array: lab Enter the word to be searched in the array: ted Word not found in the array.

Step by Step Solution

3.42 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a Java program that creates a string array based on user input and then searches for a specifi... View full answer

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!