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 02:10
3. (5 points) describe what would be printed by the code below or what error would occur. const char* cstr = "0123456"; const char* ptr = & cstr[4]; cout < < ptr[-1] < < ptr < < endl; 1 4. (5 points) theseus has been trapped in a maze with a minotaur, which is trying to capture him. each round, theseus and the minotaur move through the maze; theseus towards the exit, and the minotaur towards theseus. theseus can move in any of the four cardinal directions, or he can wait for a round to see how the minotaur moves. write code that creates a data type to represent the possible moves that theseus could make.
Answers: 3
question
Computers and Technology, 22.06.2019 05:20
Write a program called assignment3 (saved in a file assignment3.java) that computes the greatest common divisor of two given integers. one of the oldest numerical algorithms was described by the greek mathematician, euclid, in 300 b.c. it is a simple but very e↵ective algorithm that computes the greatest common divisor of two given integers. for instance, given integers 24 and 18, the greatest common divisor is 6, because 6 is the largest integer that divides evenly into both 24 and 18. we will denote the greatest common divisor of x and y as gcd(x, y). the algorithm is based on the clever idea that the gcd(x, y) = gcd(x ! y, y) if x > = y and gcd(x, y) = gcd(x, y ! x) if x < y. the algorithm consists of a series of steps (loop iterations) where the “larger” integer is replaced by the di↵erence of the larger and smaller integer. this continues until the two values are equal. that is then the gcd.
Answers: 3
question
Computers and Technology, 22.06.2019 15:20
The north and south regions had very diferent economies in the 1800s.
Answers: 1
question
Computers and Technology, 22.06.2019 22:50
Which is the best minecraft server? a. mineplex b. worldonecraft c. 9b9t d. 2b2t
Answers: 2
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
Chemistry, 12.02.2021 17:30
question
Mathematics, 12.02.2021 17:30
question
Mathematics, 12.02.2021 17:30
question
Mathematics, 12.02.2021 17:30
Questions on the website: 13722363