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
Can someone help me?
stich3 [128]

Answer:

2nd one

Explanation:

7 0
3 years ago
Read 2 more answers
How do I send the face to the back? Seriously, I can't find out how...
makvit [3.9K]

Answer:

i think you can layer it :)

Explanation:

nice drawing btw!

8 0
3 years ago
Cable television, as well as some networks, uses ________ cable.
guajiro [1.7K]
The answer is Coaxial Cable
7 0
3 years ago
If you notice errors in your document in print preview, you need to correct them before you print by pressing ____ or clicking t
sweet-ann [11.9K]

Answer:

[Esc].

Explanation:

If there are errors in the document and I have noticed errors at the time of print preview then I should have pressed escape key to come out of the print preview and edit the document afterwards and then print the document without errors.

So what escape key does is that it takes you out of the print preview.

So we conclude that the answer is Escape key.

5 0
3 years ago
A 64-bit word computer employs a 128KB cache. The address bus in this system is 32-bits. Determine the number of bits in each fi
defon

Answer: provided in the explanation segment

Explanation:

taking a step by step process for this, we will analyze this problem,

we have that the Word size = 8 bytes

Cache size = 128 KB = 128×2¹⁰ bytes = 2¹⁷ bytes

(a). we are asked to cal for fully associative mapping with line size of  4 words.

  • fully associative mapping with line size of  4 words = 4 × 8 = 32 bytes
  • offset = log₂³² = 5 bit
  • tag = 32 - (5+0) = 27 bit
  • index bit = 0

(b). Direct mapping with the line size of 8 words:

  • here  the line size = 8×8 = 64 bytes
  • no of lines = 2¹⁷/2⁶ = 2¹¹ lines
  • offset = log ₂(2⁶) = 6 bit
  • index = log ₂(2¹¹) = 11 bit
  • tag = 32 - (5 +11) = 15 bit

(c). 2-way set associated mapping with the line size of 1 word:

  • no of lines = 2¹⁷/2³ = 2¹⁴ lines
  • offset = log₂(2³) = 3 bit
  • no of sets = 2¹⁴/2 = 2¹³ sets
  • index = log₂(2¹³) = 13 bit
  • tag = 32 - (3+13) = 16 bit

(d). 8-way set associated mapping with the line size of 2 words:

8-way set associated mapping with the line size of 2 = 2*8 = 16  bytes

  • no of lines = 2¹⁷/2⁴ = 2¹³ lines
  • no of sets = 2¹³/2³ = 2¹⁰ sets
  • offset = log₂¹⁶ = 4 bit
  • index = log ₂(2¹⁰) = 10 bit
  • tag = 32 - (4+10) = 18 bit

cheers i hope this helps!!!!

5 0
3 years ago
Other questions:
  • Which tool encrypts entire drives, rendering them unusable unless one possesses the correct key to unlock the drive?
    8·1 answer
  • Why is driving a privilege?
    15·2 answers
  • in what way do rules and laws created to address public problems affect individuals groups and business
    13·1 answer
  • This network passes data most of the time, but sometimes for reasons unknown to the junior network engineer in charge of monitor
    14·1 answer
  • In today's classrooms, computers are generally being used to
    6·1 answer
  • Els
    6·1 answer
  • _____the measuring instrument is not necssery​
    10·1 answer
  • Magbigay ng ibang produkto na ginagamitan ng kasanayan ng basic sketching shading at outlining ​
    12·1 answer
  • Name any four areas where computers are used​
    15·1 answer
  • 3.8 LAB: Read values into a list
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!