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
Wewaii [24]
3 years ago
14

#Write a function called has_a_vowel. has_a_vowel should have #one parameter, a string. It should return True if the string #has

any vowels in it, False if it does not.
Computers and Technology
1 answer:
Vladimir [108]3 years ago
8 0

Answer:

Here is code in java.

import java.util.*;

class Main

{

// main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read input from user

       Scanner obj=new Scanner(System.in);

       System.out.println("please enter a string:");

       //read the string input

       String inp=obj.next();

       // call the function to check whether string has vowel or not

       Boolean res=has_a_vowel(inp);

       // printing the result

       System.out.println("string contains vowel."+res);

     

       

   }catch(Exception ex){

       return;}

}

 // method to check string has vowel or not

public static boolean has_a_vowel(String str)

{

 // find length of the string

    int len=str.length();

   

    Boolean flag=false;

     int i;

    for( i=0;i<len;i++)

    {

        char chh=str.charAt(i);

         // if string contains vowel then flag will be true

        if(chh=='a'||chh=='e'||chh=='i'||chh=='o'||chh=='u')

        {

            flag=true;

            break;

        }

    }

     //returning the result

    return flag;

}

}

Explanation:

Create a scanner class object to read the string and assign it to variable

"inp".Call the function "has_a_vowel" with a string parameter.In this function

find the length of string and travers the string.If there is any vowel character

in the string then flag will be set to true otherwise flag will be false. Then it will

return the value of flag.We can test the function from the main by passing a string parameter.

Output:

please enter a string:                                                                                                                                        

vjcavcavacvajjfd                                                                                                                                              

string contains vowel:true

please enter a string:                                                                                                                                        

sdfdhgjkhltyrqwzxcvbmm                                                                                                                                        

string contains vowel: false                                                                                                                                  

                             

You might be interested in
The ‘capacity for emergency management and response personnel to interact and work well together’ describes which of the key com
dybincka [34]

Answer:

The correct answer to the following question is option A. Interoperability

Explanation:

Interoperability is the capacity to interact and work together. In other words, interoperability is an ability in which different types of systems, applications, products or devices to communicate and connect to work together, without any effort of end-user.

Interoperability is that property which allows for an unrestricted sharing of the resources between the different systems.

5 0
3 years ago
Read 2 more answers
Which function in spreadsheet software can be used to predict future sales or inventory needs?
melisa1 [442]
create a forecast, Excel creates a new worksheet that contains both a table of the historical and predicted values and a chart that expresses this data. A forecast can help you predict things like future sales, inventory requirements, or consumer trends.
6 0
3 years ago
Read 2 more answers
A new object of type list is created for each recursive invocation of f.A. TrueB. False
sammy [17]

Answer:

True but double check!

7 0
3 years ago
____________ markup languages contain sets of directions that tell the browser software how to display and manage a web document
alekssr [168]
Hyper Text Markup Language (HTML).
5 0
4 years ago
The "Father of the Computer" was _____________, an Englishman, who in 1836 produced designs for a "computer" that could conduct
Leviafan [203]

Answer:

Charles Babbage is the correct answer to the following question.

Explanation:

Charles Babbage is the person who invented the computer, but he failed to build the computer system and the first engine was finished in year 2002 in London, after 153 years of his death but he was an inventor and the father of the automatic computing engines.

So, that's why he was called as the "Father of Computer".

5 0
3 years ago
Other questions:
  • Which of the following attacks is MOST likely the cause when a user attempts to go to a website and notices the URL has changed?
    10·1 answer
  • Apakah maksud input dan output ?<br>​
    12·1 answer
  • 3. You arrive at an intersection with traffic lights that are not working because of a power outage. What do you do?
    9·1 answer
  • Why are hardline Ethernet connections always faster than WiFi?
    8·1 answer
  • Does anyone know the code for codeHS 5.4.7 teenagers?
    8·1 answer
  • Answer ASAP and I'll give brainliest.
    10·2 answers
  • A friend was just promoted to a new job that requires part-time travel, and he has also been promised a new laptop after his fir
    10·1 answer
  • Which options can be adjusted in the print settings?
    8·2 answers
  • How can ICT be a tool in connecting all stakeholders in your community?
    5·1 answer
  • TensorFlow and Pytorch are examples of which type of machine learning platform?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!