Answered Essay: Write a program that manipulates a string entered by the user.

Program #1 String Processing  – Based on Chapter 10

Write a program that manipulates a string entered by the user.

The program should start by asking the user to enter a word, a sentence, or a string of numbers.  Store whatever the user enters into a C++ string.

The program should then display the following menu:

USE THIS MENU TO MANIPULATE YOUR STRING

—————————————-

1) Inverse String

2) Reverse String

3) To Uppercase

4) Jumble String                                                    4-1 Sample Run

5) Count Number Words

6) Count Consonants

7) Enter a Different String

8) Print the String

Q) Quit

¨      If the user selects 1:  Inverse the upper and lower case letters of the string.  If the string contains numeric characters or special characters do not change them.  NOTE:  This option should actually change the string to its inverse.  Note this option does not display the changed string.  If a user wanted to inverse the string and then display the string’s inverse they would select option 1 and then they would select option 8.

 

Example:  If the string is:  My name is John and I am 20 years old.

The inverse would be:  mY NAME IS jOHN AND i AM 20 YEARS OLD.

¨      If the user selects 2: – Reverse the order of the characters in the string.  NOTE:  This option should actually change the string to its reverse.  Note this option does not display the changed string.  If a user wanted to reverse the string and then display the string’s reverse they would select option 2 and then they would select option 8.

Example:  If the string is:  2015

The reverse would be:  5102

¨      If the user selects 3:  Convert all of the characters in the string to uppercase.  If the String contains numeric characters or special characters do not change them.  NOTE:  This option should actually change the string to all uppercase letters.  Note this option does not display the changed string.  If a user wanted to change the string to uppercase and then display the new string (in all uppercase) they would select option 3 and then they would select option 8.

¨      If the user selects 4:– Call a function named jumbleString.  The jumbleString function takes a string as input and displays a jumbled version of that string.   The jumbleString function should be called using current version of the string an argument (input) to the function.

Example:  If the string passed to the jumbleString function is: hello

A jumbled version of the word would be:  elhlo

Note 1: there are many different jumbled versions of each word that the jumbleString function could display.  So elhlo is not the only correct output for the above example.

Note 2:  Notice that this option does not actually change the string like the first two menu selections do, the jumbleString function just displays a jumbled version of the string rather than actually changing the string

¨      If the user selects 5: Call a function named countWords that counts the number of words in the current string and displays a message stating how many words are in the string

Examples:    The string “2015” has one word

The string “Hello World” has two words

The string “  I     am     Woman     ” has 3 words

¨      If the user selects 6:  Call a function named countConsonants that counts the number of consonants in the current string and displays a message indicating how many consonants the string contains.  Consonants are letters that aren’t vowels.

Example:  If the string is:  Hello

The number of consonants is: 3

So display:  “The number of consonants in the string is 3.”

¨      If the user selects 7:  Let the user enter another string for processing.  (This should just change the string stored in the original string variable you created at the beginning of the program)

¨      If the user selects 8:  Print the String

o   So if the original string was “Hello” and the user processed the string with option 3 followed by option 2, followed by option 8, the string would print out as “OLLEH” (This is hello first converted to uppercase and then reversed).

¨      If the user selects ‘Q’ or ‘q’: Quit the program

¨      Allow the user to continue processing strings (using the menu) until they select ‘Q’ or ‘q’ to quit

¨      If the user makes an invalid menu selection, print an error message to the screen

Your program must include the following three functions (you can include more if you want):

1.      countWords:  A function that takes a string as an argument and counts the number of words in it  (this function should return an int which is the number of words in the string)

2.      countConsonants:  A function that takes a string as an argument and counts the number of consonants in it  (this function should return an int which is the number of consonants in the string)

3.      jumbleString:  A function that take a string as an argument and displays a jumbled version of the original string.

Expert Answer

 

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?