1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
iVinArrow [24]
3 years ago
5

Write a program named CountVowelsModularized that passes a string to a method that returns the number of vowels in the string.

Computers and Technology
1 answer:
KengaRu [80]3 years ago
7 0

Answer:

<em>import java.util.Scanner;</em>

<em>public class CountVowelsModularized {</em>

<em>    public static void main(String[] args) {</em>

<em>        Scanner in = new Scanner (System.in);</em>

//Prompt user to enter a string, receive it and assign to a variable<em>        </em>

<em>System.out.println("Enter a string Value");</em>

<em>        String word =in.nextLine();</em>

//Calling the method numVowels and passing the string

<em>        System.out.println("The Number of vowels are " +numVowels(word.toLowerCase()));</em>

<em>    }</em>

<em>}</em>

The method definition and complete program is given in the explanation section<em> </em>

Explanation:

<em>import java.util.Scanner;</em>

<em>public class CountVowelsModularized {</em>

<em>    public static void main(String[] args) {</em>

<em>        Scanner in = new Scanner (System.in);</em>

<em>        System.out.println("Enter a string Value");</em>

<em>        String word =in.nextLine();</em>

<em />

<em>        System.out.println("The Number of vowels are " +numVowels(word.toLowerCase()));</em>

<em>    }</em>

<em>    public static int numVowels(String string) {</em>

<em>        int counter = 0;</em>

<em>        for (int i = 0; i < string.length(); i++) {</em>

<em>            if (string.charAt(i) == 'a' || string.charAt(i) == 'e' || string.charAt(i) == 'i'</em>

<em>                    || string.charAt(i) == 'o' || string.charAt(i) == 'u') {</em>

<em>                counter++;</em>

<em>            }</em>

<em>        }</em>

<em>        return counter;</em>

<em>    }</em>

<em>}</em>

You might be interested in
Which of the following is not true about a computer byte? A) It is made up of 8 bits. B) Each letter of the alphabet is stored i
sergey [27]

Answer:

C) It can either be a 1 or a 0.

Explanation:

Computer byte is a collection of eight bits of data. Computers are electronic or digital devices that communicats usinv bits of data. The bits can be converted to byte and kilobytes, megabytes etc, to promote the speed of communication between the components of digital devices. A each bit position of a byte represents a decimal value. A byte combination can represent a word, number or a special character.

8 0
3 years ago
Consider this C Program C++ Program Java Program or C# Program. It reads integers from the
LiRa [457]

Answer:

yeah

Explanation:

Consider this C Program or Java Program or Python Program. It reads integers from the standard input (until it gets a negative number) and puts them into an array. After that it calls processArray on the array, and then prints the contents of the array on standard output.

Currently, processArray does not modify the array. You have to change this program so that any sequence of two or more consecutive numbers even numbers in the array are removed from the array and replaced with just the first number of the sequence. In other words, in any sequence of even numbers, only the first number is retained and the others are removed. The processArrayfunction/method should modify the array in-place (preferably without creating a new array), and it should return the new length of the modified array

4 0
3 years ago
Do you like Anime and if so if your 13-15 let’s be friends my number is 954 643 2050
BlackZzzverrR [31]

Answer:

nah fam

Explanation:

miss me with those 2d women

5 0
3 years ago
Based on the following quote from Leonardo Da Vinci, what would be his definition of a fine artist? “Principles for the Developm
zvonat [6]

Answer:

A fine artist is one who sees the things other don't see and make connections other don't make.

7 0
3 years ago
Read 2 more answers
The reader can tell from the Article that __________.
Dmitry_Shevchenko [17]

Answer:

D. NASA would have preferred that the process for making trajectory calculations during the 1930s and 1940s had not been brought to light.

7 0
3 years ago
Other questions:
  • Explain how abstraction is used in a GPS system
    12·2 answers
  • ?the single most effective security measure for digital devices is to password protect access to them.
    5·1 answer
  • Which component of the Hyper-V architecture controls all communication with the physical hardware on the computer?
    8·1 answer
  • If a stop-and-wait protocol is used, what is the fraction of time, in seconds, that the sender is busy sending bits into the cha
    8·1 answer
  • Join my among us code<br> SHUHZF
    6·2 answers
  • 2.cite at least 2 example on how multimedia facilitates learning​
    6·1 answer
  • Write an application that displays the sizes of the files lyric1.txt and lyric2.txt in bytes as well as the ratio of their sizes
    15·1 answer
  • Which of the following tools helps ensure your document will open in older versions of word
    13·1 answer
  • Sube
    10·2 answers
  • A(n) _____ is any group of characters enclosed within either double or single quotation marks in javascript.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!