Write a class that completes the following tasks: Read all of the lines from the
ID: 3657244 • Letter: W
Question
Write a class that completes the following tasks: Read all of the lines from the provided file dictionary. txt and store them in an array of Strings. You can hardcode the input filename and you can take advantage of the fact that there are exactly 9992 lines in the file (this is a spellcheck dictionary file so I don't take any responsibility for any questionable or offensive words contained within). The idea here is to create an array that is the right size to hold each of the words (one per line in the file) and then, in a loop add them to the array - first word in array [ 0 ], next in array [ 1 ] ... and so on. Modify the selection sort method from the book (or slides) so that it will sort an array of Strings in alphabetical order. Your method should have the header: public static void selectionSort(String[] array) Your sort should be case-insensitive so that upper and lower case words are considered equal for the sorting. Call this method in main ( ) to sort the array of Strings that you read in from the file. To show that it is soiled display only the first 5 and last 5 in the array as there are too many to print to the screen. Write a linear search method with the following header: public static int linearSearch(String[] array, String s) that returns the index (position) of String s in the array if it is found and -1 if it is not found. The method should return the first occurrence of the string if it occurs multiple times in the array. Show that your search method is working by prompting the user to enter in strings to find. Loop the search request until the user enters the empty string"".Explanation / Answer
example public class selectionSort{ public static void main(String a[]){ int i; int array[] = {12,9,4,99,120,1,3,10}; System.out.println(" RoseIndia "); System.out.println(" Selection Sort "); System.out.println("Values Before the sort: "); for(i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.