Question
C# Summary: Methods, overloading, optional parameters. Write a program that will analyze text. Write a function that will take a string parameter with Hello as
C#
Summary: Methods, overloading, optional parameters.
Write a program that will analyze text.
Write a function that will take a string parameter with "Hello" as the default value for the optional parameter, this function will count the number of words in the string. Assume that a word is identified by a single space character. The return is the count of words.
Overload the above function by allowing it to take an array of strings. (There must be two separate functions.)
Write a function that will count the number of vowels in a string. The return is the count of vowels, case-insensitive.
Create a menu system similar to the sample output. When at the bottom of each menu level, continue to perform the same operation until the user inputs the escape sequence. i.e. -1
Example run:
Main Menu Choose from the following: 1. Word counting. 2. Vowel counting. 3. Exit Enter your selection: 1 Word Counter Menu Choose from the following: 1. Count the words in one sentence. 2. Count the words in a paragraph. 3. Parent menu Enter your selection: 1
Enter a sentence (q to quit, d for default): Hello world, how are you today? There are 6 words in the sentence "Hello world, how are you today?". Enter a sentence (q to quit, d for default): I'm bored today. There are 3 words in the sentence "I'm bored today.". Enter a sentence (q to quit, d for default): d There is 1 word in the sentence "Hello". Enter a sentence (q to quit, d for default): q
Word Counter Menu Choose from the following: 1. Count the words in one sentence. 2. Count the words in a paragraph. 3. Parent menu Enter your selection: 2
Enter several sentences, when done entering sentences, use q by itself on the last line. Hello, how are you? I'm fine, and you? Just fine, just fine. q There are 12 words in that text.
Enter several sentences, when done entering sentences, use q by itself on the last line. q
Word Counter Menu Choose from the following: 1. Count the words in one sentence. 2. Count the words in a paragraph. 3. Parent menu Enter your selection: 3
Main Menu Choose from the following: 1. Word counting. 2. Vowel counting. 3. Exit Enter your selection: 2
Vowel Counting Menu Choose from the following: 1. Count vowels. 2. Parent menu. Enter your selection: 1
Please enter some text to count the vowels (q to quit). Hello Abe, what are you up to today? There are 13 vowels. Please enter some text to count the vowels (q to quit). q
Vowel Counting Menu Choose from the following: 1. Count vowels. 2. Parent menu. Enter your selection: 2
Main Menu Choose from the following: 1. Word counting. 2. Vowel counting. 3. Exit Enter your selection: 3
Goodbye.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started