subject

Write a class with a constructor that accepts a String object as its argument .The class should have a method that returns the number of vowels in the string ,and another method that returns the number of consonants in the string .(Spaces count as neither vowels nor consonants and should be ignored.)Demonstrate the class in a program that performs the following steps:1. The user is asked to enter a string .2. The program displays the following menu:1. Count the number of vowels in the string2. Count the number of consonants in the string3. Count both the vowels and consonants in the string4. Enter another string5. Exit the programThe user can select options by inputting the appropriate number. If option 1, 2, or 3 is selected, the result should be printed to the screen. When displaying the number of vowels, do it in the format:Vowels: 3When displaying consonants, do it in the format:Consonants: 5When displaying both, do it in the format:Vowels: 3Consonants: 53. The program performs the operation selected by the user and repeats untilthe user selects 5 to exit the program. Sample Output:Enter a string: a number1. Count the number of vowels in the string2. Count the number of consonants in the string3. Count both the vowels and consonants in the string4. Enter another string5. Exit the program:1Vowels: 16Enter a number1. Count the number of vowels in the string2. Count the number of consonants in the string3. Count both the vowels and consonants in the string4. Enter another string5. Exit the program:2Consonants: 18Enter a number1. Count the number of vowels in the string2. Count the number of consonants in the string3. Count both the vowels and consonants in the string4. Enter another string5. Exit the program:4Enter a string:A spoonful of sugar makes the medicine go downEnter a number1. Count the number of vowels in the string2. Count the number of consonants in the string3. Count both the vowels and consonants in the string4. Enter another string5. Exit the program:3Vowels: 16Consonants: 22Enter a number1. Count the number of vowels in the string2. Count the number of consonants in the string3. Count both the vowels and consonants in the string4. Enter another string5. Exit the program:5

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:40
Pthreads programming: create and terminate a thread write a c++ program that creates a thread. the main will display a message “hello world from the main”. the main will create a thread that will display a message “hello world from the thread” and then terminates with a call to pthread_exit()
Answers: 3
question
Computers and Technology, 24.06.2019 15:50
Andy would like to create a bulleted list. how should he do this? andy should click on the bullet icon or select the bullet option from the menu and then type the list. andy should press the shift key and the 8 key at the beginning of each line of text. andy should type the text and then click on the bullet command. andy should press return and the bullets will automatically
Answers: 2
question
Computers and Technology, 26.06.2019 07:00
What's better: a) ps4 b) pc c) xbox one d) nintendo switch
Answers: 2
question
Computers and Technology, 26.06.2019 14:00
Which term describes the situation wherein a jury fails to reach a unanimous verdict? a occurs when a jury cannot reach a unanimous verdict.
Answers: 1
You know the right answer?
Write a class with a constructor that accepts a String object as its argument .The class should have...
Questions
question
Mathematics, 16.12.2020 16:40
question
Business, 16.12.2020 16:40