Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to solve this using JavaScript? How poetical a word is can be found by looking at three factors: - Presence of vowels, A, E,

How to solve this using JavaScript?

image text in transcribed

How poetical a word is can be found by looking at three factors: - Presence of vowels, A, E, I, O,U, and Y, because these are soft and pleasing - Absence of the letters K and X, because these are harsh and unpleasant - Order in the poem, because earlier words are more important A poem is a series of English words separated by spaces. We can assign a poetry score to any word in a poem by following these steps: - Count the number of vowels - Subtract 1 for each ' k ' - Subtract 2 for each ' X ' If multiple words in a poem have the same score, the earlier word is more poetical. Example poem = "Like feeble age he reeleth from the day" The poetry scores of these words are 1,3,2,1,3,1,1,1 and "feeble" is the most poetical word. Function Description Complete the function mostPoeticalWord in the editor below. mostPoeticalWord has the following parameter(s): string poem: a poem string Returns: string: the word that is first occurrence with the highest poetry score Constraints - 1 length of poem 105 - The poem string consists of spaces and letters in the range ascii[a-z, A-Z, ] only

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Optimizing Data Collection In Warzones

Authors: Aaget Aamber

1st Edition

B0CQRRFP5F, 979-8869065902

More Books

Students also viewed these Databases questions

Question

What does CLOSE do?

Answered: 1 week ago

Question

1. Why do we trust one type of information more than another?

Answered: 1 week ago