Question: Beginner Java help. please don't make the program too complex. Complete each of the following String manipulation problems in a file called World.java. Your program

Beginner Java help. please don't make the program too complex.

Complete each of the following String manipulation problems in a file called World.java. Your program should read in two Strings from the keyboard as shown below. It should then do the following:

Measure the length of both words entered by the user and save the length in the related variable. Then use an if-statement to compare the two word lengths and print the word that is longer.

Determine whether the two words are the same (Hint: remember the equals method?)

Concatenate the first 2 letters of the variable first and the last 3 letters of variable second. Assign the result of the concatenation operations to variable extract. Hint: Use charAt()

Note that you may assume the user enters words of sufficient length to complete this step

Compare the two words using compareTo to determine which one comes first alphabetically.

Sample Output: The input prompts and outputs of the program must look like the following for full credit, including the same order of input and exact wording of the output. For the input shown you must get the same output. However, the output must change properly if the inputs are different.

*** String Manipulation ***

Enter two words separated by a space, and press the Enter key

Enter your input: Hello World!

You entered: first = "Hello" and second = "World!"

First word length: 5

Second word length: 6

Longer word: World!

Words are the same: false

Merged words: Held!

Word order: Hello comes before World!

In the sample output, the user entered the words shown in italics (for emphasis) to produce the output. Your program does NOT print the characters in italics, nor does the user input appear in italics.

*** String Manipulation ***

Enter two words separated by a space, and press the Enter key

Enter your input: Bye Bye

You entered: first = "Bye" and second = "Bye"

First word length: 3

Second word length: 3

Longer word: Bye

Words are the same: true

Merged words: ByBye

Word order: Bye comes before Bye

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!