[Solved] CSE1342 Authoring Assistant (C++)

$25

File Name: CSE1342_Authoring_Assistant_(C++).zip
File Size: 310.86 KB

SKU: [Solved] CSE1342 Authoring Assistant (C++) Category: Tag:
5/5 - (1 vote)

Instructor note:

You will be completing the implementation of a program that is partially written and tested. Your first step is to compare the program requirements to the partially complete solution. Then implement the missing parts and tests only those parts.

(1) Prompt the user to enter a string of their choosing. Store the text in a string. Output the string. (1 pt)

Enter a sample text:

We 11 continue our guest in space. There will be more shuttle flights and more shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends here;

our hopes and our journeys continue !

You entered: We 11 continue our quest in space. There will be more shuttle flights and more more volunteers, more civilians,

more teachers in space. Nothing ends

shuttle crews and, yes ,

our hopes and our journeys continue!

here;

(2) Implement a PrintMenu() function, which has a string as a parameter, outputs a menu of user options for analyzing/editing the string, and returns the users entered menu option. Each option is represented by a single character.

If an invalid character is entered, continue to prompt for a valid choice. Hint: Implement Quit before implementing other options. Call PrintMenu() in the main() function. Continue to call PrintMenu() until the user enters q to Quit. (3 pts)

Number Of nonwhi tespace characters

Number of words

Find text

f

Replace all ! s

Shorten spaces

g Quat

Choose an option:

(3) Implement the GetNumOfNonWSCharactersO function. GetNumOfNonWSCharacters() has a constant string as a parameter and returns the number of characters in the string, excluding all whitespace Call GetNumOfNonWSCharacters() in the PrintMenu() function. (4

pts)

Ex

Number of nonwhitespace characters: 181

(4) Implement the GetNumOfWords() function. GetNumOfWords() has a constant string as a parameter and returns the number of words in the string. Hint: Words end when a space is reached except for the last word in a sentence Call GetNumOfWords() in the PrintMenu()

function. (3 pts)

Number Of words

: 35

(5) Implement the FindTextO function, which has two strings as parameters. The first parameter is the text to be found in the user provided sample text, and the second parameter is the user provided sample text. The function returns the number of instances a word or phrase is found in the string. In the PrintMenu() function, prompt the user for a word or phrase to be found and then call FindText() in the PrintMenuO function. Before the prompt, call cin.ignore() to allow the user to input a new string. (3 pts)

Enter a word phrase to be found:

more

more instances: S

(6) Implement the ReplaceExcIamationO function. ReplaceExclamationO has a string parameter and updates the string by replacing each character in the string with a character. ReplaceExclamatlon() DOES NOT output the string. Call ReplaceExclamation() in the PrintMenu()

function, and then output the edited string. (3 pts)

Ex.

Edited text: We 11 continue our quest in space.

There Will be more shuttle flights and more

shuttle crews and, yes,

more volunteers, more civilians,

more teachers in space. Nothing ends

here; our hopes and our journeys continue.

(7) Implement the ShortenSpace() function ShortenSpace() has a string parameter and updates the string by replacing all sequences of 2

or more spaces with a single space. Shortenspace() DOES NOT output the string. Call Shortenspace() in the PrintMenu() function, and then

Output the edited string. (3 pt)

Edited text: neII continue our guest in space. There will be more shuttle flights and more

shuttle crews and, yes, more volunteers, more civilians, more teachers in space. Nothing ends

hexe; our hopes and our jouzneys continue!

S int string

5.19.1: Authoring Assistant (C++)

3 using namespace Sta;

Il int string usrStr) {

main.cpp

0/35

Load default template

usrStr) {

for (i

  • COunt

< usrStr.size()

22

( s (usrStr.at(i))

if ( ace(usrStr.

Submit mode

Develop mode

Enter Droaram inout (0Dtional)

Run your program as often as youd like, before submitting for grading Below, type any needed

input values in the first box, then click Run program and observe the programis output in the

second box.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE1342 Authoring Assistant (C++)
$25