Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a recursive function to print the punctuation in a string containing a sentence. For example, for the sentence S, where: S = Every day

Write a recursive function to print the punctuation in a string containing a sentence.

For example, for the sentence S, where:

S = Every day is a gift!, said the parent to their child.

The recursive function punctuation(S) will print:

!,.

Write the base cases and recurrence relationship for the function in the comments that describe your function, as you did for problem A above.

You should embed the function in a program that calls the recursive function to find the punctuation in different sentences input by the user. Your program should obtain a sentence from the user via the console. Your program should also contain a continuation loop that prompts the user to determine if they would like to continue.

One sample run of your program should be similar to the following:

Enter a Sentence: Every day is a gift!

The punctuation is: !

Would you like to continue? (Enter Y or N): N

Your program should check for the following punctuation marks (specified between the braces {} below with a space in between each punctuation mark):

{ . , ! ? : ; }

Note, we assume that the double quote: is equivalent to:

And the single quote: is equivalent to:

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

More Books

Students also viewed these Databases questions

Question

Question Can I collect benefits if I become disabled?

Answered: 1 week ago

Question

Question May I set up a Keogh plan in addition to an IRA?

Answered: 1 week ago