Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Comparatives & Superlatives Woodward ADJECTIVE nice COMPARATIVE -R nicer stranger SUPERLATIVE - ST the nicest the strangest ONE Syllable Ending in E strange COMPARATIVE Harry

image text in transcribed

Comparatives & Superlatives Woodward ADJECTIVE nice COMPARATIVE -R nicer stranger SUPERLATIVE - ST the nicest the strangest ONE Syllable Ending in E strange COMPARATIVE Harry is nicer than Frank. adjective+ Dean Harry Frank SUPERLATIVE Dean is the nicest. the adjectives There are common rules to generate the comparative and superlative forms of an adjective. In this part of the assignment, you are asked to implement and test the recommend function in week7 comparative superlative project. void recommend (string word, string& more, string& most); The first parameter of the function, word, is pass-by-value. It is expecting an adjective word. The second and third parameters of the function are pass-by-reference. The recommend function must update the parameter more with the comparative form of the word parameter and update the parameter most with the superlative form of the word parameter. To simplify the problem, the program needs to follow only three rules: If an adjective ends with the letter 'e', its comparative form will simply add "t and its superlative form will simply add "st". This is illustrated by the above screenshot If an adjective ends with the letter 'y', its comparative form will replace the 'y' withier and its superlative form will replace the 'y' with iest". For example, the comparative form for "dry is drier" and the superlative form for "dry" is "driest". For all other adjectives, simply add "er and est respectively for its comparative and superlative forms. For example, the comparative form for "fast" is "faster and the superlative form for "fast" is "fastest". The main function currently includes the declaration of two string objects and some statements to illustrate how to call and test the recommend function. As shown in the above bullet list, there are several scenarios of adjectives you would need to consider in the recommend function. You are encouraged to focus on getting the function to work for one scenario and test it before expanding it to take care of another scenario. As the function is expanded, add statements in the main function to help test additional scenarios. Hint: You could use word.size() or word.length() to determine the number of characters in word. You could use word. back() to return the last character of word. The following screenshot shows a sample run of a completed program. No user input is needed for this program. You are required to test the recommend function using at least three adjectives that are different from the following. adjective comparative superlative nice strange dry happy fast strong nicer stranger drier happier faster stronger nicest strangest driest happiest fastest strongest

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

Step: 3

blur-text-image

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

Databases Demystified

Authors: Andrew Oppel

1st Edition

0072253649, 9780072253641

More Books

Students also viewed these Databases questions