Question: Write a Java program that asks the user a sentence: word1 word2 word3 word4. Your prompts to the user must be: Enter four works: Output

Write a Java program that asks the user a sentence: word1 word2 word3 word4.

Your prompts to the user must be:

Enter four works:

  • Output word1 and the length of word1 and the position of all the vowels (a, e, i, o, u) in word1

  • Output word2 and the length of word2 and the position of all the vowels (a, e, i, o, u) in word2

  • Output word3 and the length of word3 and the position of all the vowels (a, e, i, o, u) in word3

  • Output word4 and the length of word4 and the position of all the vowels (a, e, i, o, u) in word4

Sample runs would look like:

Enter 4 words: she smiles third frisbee Word 1 = "she" Length = 3 position of vowels: 'a' = -1, 'e' = 2, 'i' = -1, 'o' = -1, 'u' = -1

Word 2 = "smiles" Length = 6 position of vowels: 'a' = -1, 'e' = 4, 'i' = 2, 'o' = -1, 'u' = -1

Word 3 = "third" Length = 5 position of vowels: 'a' = -1, 'e' = -1, 'i' = 2, 'o' = -1, 'u' = -1

Word 4 = "frisbee" Length = 7 position of vowels: 'a' = -1, 'e' = 5, 'i' = 2, 'o' = -1, 'u' = -1

or Enter 4 words: shoe shoe chime wallabees Word 1 = "shoe" Length = 4 position of vowels: 'a' = -1, 'e' = 3, 'i' = -1, 'o' = 2, 'u' = -1

Word 2 = "shoe" Length = 4 position of vowels: 'a' = -1, 'e' = 3, 'i' = -1, 'o' = 2, 'u' = -1

Word 3 = "chime" Length = 5 position of vowels: 'a' = -1, 'e' = 4, 'i' = 2, 'o' = -1, 'u' = -1

Word 4 = "wallabees" Length = 9 position of vowels: 'a' = 1, 'e' = 6, 'i' = -1, 'o' = -1, 'u' = -1

Please make sure to end each line of output with a newline.

Note: If there are multiple instances of the same vowel, only the index of the first occurrence should be used

Please note that your class should be named Words.

Write the input as well.

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!