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
Now you are ready to implement a spell checker by using or quadratic. Given a document, your program should output all of the co
Harlamova29_29 [7]

Answer:

Sorry po idont know po ehhh sorry

5 0
3 years ago
Need help with these
kolbaska11 [484]
The first one is d the second one is true the third one is false
3 0
3 years ago
In what domain electrica energy is the most use
amm1812

Answer:the main signal bearing entities are voltage and their current in circuit environments.

Explanation:

5 0
3 years ago
Plz help me i need it asap
Ulleksa [173]

Voyager

Shortly after the Pioneers made their flybys, the Voyager1 and Voyager 2 probes followed. They made many important discoveries aboutJupiter and Saturn, including rings around Jupiter and the presence ofvolcanism on Jupiter's moon, Io. Voyager went on to make the first flybys ofUranus, where it discovered 10 new moons, and Neptune, where it found thatNeptune actually weighs less than astronomers thought. Both Voyager crafts have enough power to keep transmitting radio signals until at least 2025, and are now exploring the very edge of the solar system and beginning of interstellar space. Voyager 2 is currently the farthest man-made object from Earth, at more than a hundred times the distance from the Earth to the sun, and more than twice as far as Pluto.

I hope this helps chu

4 0
3 years ago
Please please help I don’t understand this
garik1379 [7]

Answer:

It is this because yass

Explanation:

And yes

6 0
2 years ago
Read 2 more answers
Other questions:
  • Achieving a degree in computer forensics, information technology, or even information systems can provide a strong foundation in
    11·1 answer
  • The term composite would be used to describe an image that was altered by the Crop tool.
    15·1 answer
  • You are designing a wireless network for a client. Your client needs the network to support a data rate of at least 54Mbps. In a
    11·1 answer
  • Web and mobile applications are created for users to only read information. True False
    15·2 answers
  • What does the following loop do?
    5·1 answer
  • What differentiates physical design from logical design?
    7·1 answer
  • Many large IT departments use a(n) _____ team that reviews and tests all applications and systems changes to verify specificatio
    6·1 answer
  • Write a SELECT statement that returns three columns: EmailAddress, OrderID, and the order total for each customer. To do this, y
    14·1 answer
  • What means the data is still saved even if you turn the computer off or unplug it?​
    5·1 answer
  • if we try to use tail-recursive rules to implement non-tail-recursive rules, it will normally result in rules that are
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!