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
I need help making this table in html code I have some of chart done but idk where to go after the 6:30pm part
Bumek [7]

dvioubfeevuf is hsvqvuvsqv

5 0
3 years ago
Assume that the population of Mexico is 114 million and that the population increases 1.01 percent annually. Assume that the pop
AfilCa [17]

Answer:

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variables

   double mexico = 114;

   double usa = 312;

   double mexicoRate = .0101;

   double usaRate = .0015;

// calculate population after every year until mexico population exceed the usa populationn

   while (usa>mexico)

   {

// print the population

       cout<<"Mexico's population ::"<<mexico<<" million."<<endl;

       cout<<"USA's population ::"<<usa<<" million."<<endl;

// update the population

       mexico+=mexico*mexicoRate;

       usa-=usa*usaRate;

   }

return 0;

}

Explanation:

Declare and initialize mexico and usa with their initial population.Also declare and initial their increase and decrease rate.Find the population of both the  country each year until mexico population exceeds the usa population.

Output:

Mexico's population ::114 million.                                                                                          

USA's population ::312 million.                                                                                            

Mexico's population ::115.151 million.                                                                                      

USA's population ::311.532 million.

.

.

.

Mexico's population ::270.546million.                                                                                      

USA's population ::274.213 million.                                                                                        

Mexico's population ::273.278million.                                                                                      

USA's population ::273.802 million.

6 0
3 years ago
Scripting languages are unique computer languages with a specialized function. explain what scripting languages do, and how this
yarga [219]

Scripting languages are unique computer languages because they automate task that could be done by human operator and are easy to use.

<h3>What is a scripting language?</h3>

Scripting languages are programming languages that is interpreted.

They are programming languages that automates the task that will originally be performed by a human operator.

Scripting languages are used to give instruction to other software to run accordingly to how you want it.

The scripting language is different form other language base on the fact that its interpreted . This means the code are translated to machine code when it is run.

The major advantage of scripting languages is that it is human readable and understandable.

Examples of scripting languages are Python and JavaScript.

learn more on scripting here: brainly.com/question/12763341

#SPJ1

3 0
2 years ago
Write an algorithm to print the minimum and maximum of an integer array. Your need to pass the array as a parameter. Since we ca
sammy [17]

Answer:

See explaination

Explanation:

MinMax.java

import java.util.*;

public class MinMax

{

static void MinMax(int[] arr)

{

int Min=arr[0]; // initializinf min and max with 1st value of array

int Max=arr[0];

for(int i=0;i<arr.length;i++) // iterating loop only once

{

if(arr[i]>Max) // checking max value

{

Max=arr[i];

}

if(arr[i]<Min) // checking min value

{

Min=arr[i];

}

}

System.out.println("Min Number is "+Min); //printing min value

System.out.println("Max Number is "+Max); //printing max value

}

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter N value: "); // taking n value

int n=sc.nextInt();

int[] arr=new int[n];

System.out.println("Enter N elements:"); // taking n elements into array

for(int i=0;i<n;i++)

{

arr[i]=sc.nextInt(); // each element into the array

}

MinMax(arr); // calling MinMax() method.

}

}

4 0
3 years ago
When looking at a maple tree, you learn that many maple tree leaf cells are capable of creating food from the sun and sustaining
Usimov [2.4K]

it tells you that the sun give the msple tree energy to produce food for its leaf's and if it can no longer produce enough energy to make food for the leaf's of the maple tree then the tree will either die of no energy or die of no leaf's to give the soil's food for the tree

4 0
3 years ago
Other questions:
  • The Internet and World Wide Web allow almost any business to be global. What are two important results of this process?
    8·1 answer
  • When performing a basic search with Bing, you first type in your search expression and then click a button to begin the search;
    13·1 answer
  • Microsoft Windows is the least used operating system. TRUE or FALSE.
    13·1 answer
  • The construction of a mixed media assemblage would be considered
    9·1 answer
  • Select the correct answer.
    7·1 answer
  • How are Earth's plates made?
    14·1 answer
  • JUST NEED TO KNOW WHO ALL DOSE EDGINUITY
    12·2 answers
  • How do computer users benefit from the increased speed?
    9·1 answer
  • When would instant messaging be the least effective means of communication
    9·1 answer
  • A Python file that contains variables and functions and can be used in other programs is called a
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!