Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:00, floydsidney1119
Think about some of the most memorable and forgettable games ever created. they can be games that were discussed in this unit or otherwise. what are some of the consistent factors that made certain games memorable to you? what were some of the consistent factors that made certain games forgettable to you? why? explain.
Answers: 1
image
Computers and Technology, 22.06.2019 11:00, Yamari000
What are two of the most common reasons that peolpe who need mental health care do not access it?
Answers: 1
image
Computers and Technology, 24.06.2019 02:00, destinyd10189
Read the following scenario, and then answer the question below. you want to send an e-mail to your boss requesting a meeting to discuss a raise. what is the best example of an e-mail to an employer about this meeting? “hey jason. can we chat about getting me more money soon? let me know. peace, meg.” “hello jason. pardon me for sending yet another e-mail today about my need to talk to you about my position and a possible pay increase. i am dying to know when you can talk. sincerely, meg.” “hello jason. i have been with the company for one year and have taken on more responsibilities than outlined in my job description. i would appreciate an opportunity to speak with you about my position. let me know when we can schedule a meeting. you, meg.” “greetings jason! i hope this e-mail finds you well and happy today. i really, really want to talk to you about something important. i am not sure if you have time. i hope you do. get back in touch with me and let me know when we might talk. ever so much for taking the time to read this. sincerely, meg.”
Answers: 3
image
Computers and Technology, 24.06.2019 04:30, juliemiddleton05
1. web and mobile applications allow users to be actively engaged in an online activity. a true b false 2. some examples of business applications purposes are to collaborate, share files, meet virtually in real-time, and accept payments. a true b false 3. an education application would most likely do which of the following? a allow users to watch popular movies and tv shows b connect users with social and business contacts c confirm users' travel plans d teach users a new language 4. a uniform resource locator (url) is how the internet knows where to take users when an address is typed into a browser. a true b false 5. deon is required to provide the citation information for his sources. what type of information should he collect from his sources? a author name, title, date of publication, date of access, url b connections to background information c interesting facts and statistics d notes on important information
Answers: 1
Do you know the correct answer?
Write a class with a constructor that accepts a String object as its argument .The class should have...

Questions in other subjects:

Konu
Chemistry, 31.03.2021 05:20