Question: Can you provide a code to submit on website? Write a class with a constructor that accepts a String obiect as its argument. The class



Can you provide a code to submit on website?
Write a class with a constructor that accepts a String obiect 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 string 2. Count the number of consonants in the string 3. Count both the vowels and consonants in the string 4. Enter another string 5. Exit the program The 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: 3 When displaying consonants, do it in the format: Consonants: 5 When displaying both, do it in the format: Vowels: 3 Consonants: 5 3. The program performs the operation selected by the user and repeats until the user selects 5 to exit the program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
