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]
2 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]2 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
Assume the name of your data frame is flavors_df. What code chunk lets you review the structure of the data frame?
Svetlanka [38]

Assuming the name of your data frame is flavors_df, the code chunk which will allow review of the structure of the data frame is colnames(flavors_df).

<h3>What is Code chunk?</h3>

This is referred to a a runable piece of R code and helps to reduce incidents of mismatch pertaining to the commentary in a paper and the results being discussed.

In the case of a data frame which is flavors_df, the appropriate code chunk is colnames(flavors_df) which allow for extensive review of the item with the barest minimal error which is why it was chosen as the most appropriate choice.

Read more about Code chunk here brainly.com/question/25525005

#SPJ1

4 0
1 year ago
1. What is the main factor that affects Earth’s average temperature?
user100 [1]

Answer:

1. The Sun is the primary source of energy that influences any planet's temperature, including Earth. The amount of energy received from the Sun is called insolation; the ratio reflected is called the albedo.

2.There are three major ways in which global warming will make changes to regional climate: melting or forming ice, changing the hydrological cycle (of evaporation and precipitation) and changing currents in the oceans and air flows in the atmosphere

3.The warming of Earth is primarily due to accumulation of heat-trapping greenhouse gases, and more than 90 percent of this trapped heat is absorbed by the oceans. As this heat is absorbed, ocean temperatures rise and water expands. This thermal expansion contributes to an increase in global sea level.

4.The main sources of greenhouse gases due to human activity are: burning fossil fuels leading to higher carbon dioxide concentrations. farming and forestry — including land use change via agriculture and livestock. cement manufacture.

5. - Reduce, Reuse, Recycle

- Use Less Heat and Air Conditioning

-Use Less Hot Water

Explanation:

5 0
3 years ago
Contextual targeting method mean
Semenov [28]
Definition - What does Contextual Advertising mean? Contextual advertising is a form of online advertising that displays ads on websites based on the keywords, content or theme of the website. It is a targeted advertising technique that is commonly used in ads on blogs, websites and other online media.
3 0
2 years ago
What is the range for copper tape
jeyben [28]

Answer:

I like the song "Angel"

3 0
2 years ago
Which guideline should you follow when selecting the font for a presentation
Sladkaya [172]
My school requires us to use Arial and double space it but we have to use font size 30 for title and 24 for the paragraphs.
3 0
3 years ago
Other questions:
  • Which area of the network would a college it staff most likely have to redesign as a direct result of many students bringing the
    10·1 answer
  • How do i start makeing a Character in the Unreal Game Engine
    14·2 answers
  • What part of the boot-up process initializes hardware and finds an operating system to load?
    14·1 answer
  • Obtaining the data of a video file from a flash drive is an example of a(n) _________ operation.
    6·1 answer
  • Grace is performing a penetration test against a client's network and would like to use a tool to assist in automatically execut
    13·2 answers
  • Which type of choir often sings AND dances while they perform?
    9·1 answer
  • I came here for a answer so why did i get a pep talk
    7·2 answers
  • Leslie works in an SDLC team. When Leslie edits a file, it gets saved as an altered version. Later all the altered versions are
    9·1 answer
  • 72. In Object Oriented Programming, a class_____ starts
    12·1 answer
  • After data is collected, how is it analyzed?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!