Question: Word Sorter In order to do this, you will need to use if-else if-else statements that make use of logical operators and methods for String

Word Sorter

In order to do this, you will need to use if-else if-else statements that make use of logical operators and methods for String comparisons.

Task:Create a project called WordSorter_FirstName_LastName or Remember to include comments summarizing the program.

1.Import the Scanner class and construct an object of the Scanner class that reads keyboard input.

2.Declare three String variables that will hold three different words the user enters.

3.Print three requests to the user asking for the first, second, and third word. Store the users input for each of these requests into each of the three String variables.

4.The order of the words will depend on the order of the statementsto print those words to the console. To determine the order to print the words in, you will need to compare the words using the appropriate method of the String class.Assume that case does not matter and that the user enters three different words.Additionally, you must do comparisons between all pairs of words to determine the correct order.

For example, to determine if the last word that the user enters comes first alphabetically, you must compare this word to the other two words.If the last word does come first alphabetically, you mustthen compare the remaining two words to each other to determine which comes second alphabetically and which comes last alphabetically.

The following are two examples of the users inputs with different words in different initial orderings. The final output should be the words the user entered in alphabetical order.

run:

Please enter the first word: Candy

Please enter the second word: apple

please enter the third word: banana

apple

banana

candy

BUILD SECCESSFL (total tie: 8 seconds)

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!