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
velikii [3]
3 years ago
11

Create a recursive method, a method that calls itself, that returns the number of vowels that appear in any string given. Keep i

n mind that we will need to have a base case that will stop the method when it finishes its work (going through the string and counting the vowels).
Computers and Technology
1 answer:
kvv77 [185]3 years ago
3 0
<h2>Answer:</h2>

//Define the method as noOfVowels

   //Let it receive the string to be checked as argument

   public static int noOfVowels(String string){

   

       //Check the length of the string

       

       //If it is less than 1, then it is an empty string

       //Hence return 0

       if(string.length() < 1){    

           return 0;

       }

       

       //Else,

       else{

           //get the character at the first position in the string

           //and convert it to a lower case

           char x = string.toLowerCase().charAt(0);

           //Check if the character is a vowel

           if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u'){

               //if it is a vowel, add 1 to a recall of the method.

               //But this time, call the method with  

               //the string excluding the first character.

               //i.e the substring of the string starting at index 1 rather than 0

               return 1 + noOfVowels(string.substring(1));

           }

           

           else {

               //If it is not a vowel, just recall the method with

               //the string excluding the first character

               //i.e the substring of the string starting at index 1 rather than 0

               return noOfVowels(string.substring(1));

           }

       }

   }

   

<h2>Explanation:</h2><h2></h2>

The code has been written in Java and it contains comments explaining every part of the code. Please go through the comments carefully.

The actual lines of code have been written in bold face to distinguish them from comments.

The code is re-written without comments as follows;

   public static int noOfVowels(String string){

   

       if(string.length() < 1){    

           return 0;

       }

       

       else{

           char x = string.toLowerCase().charAt(0);

           if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u'){

               return 1 + noOfVowels(string.substring(1));

           }

           

           else{

               return noOfVowels(string.substring(1));

           }

       }

   }

   

You might be interested in
Define computer memory and write its type <br>​
Helga [31]

Answer:

Computer memory is a generic term for all of the different types of data storage technology that a computer may use, including RAM, ROM, and flash memory. ... Another way that computer memory can vary is that some types are non-volatile, which means they can store data on a long term basis even when there is no power

4 0
3 years ago
Read 2 more answers
The landing page of a web site has just been edited. Some users are complaining they do not see the updated content being displa
Anna007 [38]

In Software Engineering, when dealing with UI, there are a lot of attribute particular to text view that if not properly formatted may affect the users experience.

Two possible things that comes to my mind as a software developer are

  1. The text colour may have be altered such that it matches that of the background so that it cannot be seen anymore
  2. The text View visibility may have been set to "INVISIBLE " or "GONE"

A little more checkup and tweaking or a search from online repository can go a long way to help the situation and the right user experience will be delivered.

Learn more about web design here:

brainly.com/question/25941596

7 0
2 years ago
A security technician has been receiving alerts from several servers that indicate load balancers have had a significant increas
djyliett [7]

Answer:The capacity of the servers

Explanation:because is full

6 0
3 years ago
The Principles and Clauses in the Software Engineering Code of Ethics and Professional Practice
Assoli18 [71]

Answer:

e) None of the above

Explanation:

Software engineers should make the analysis, specification, design, development, testing and maintenance of software a respected and beneficial profession. In accordance with the obligation with the welfare, health and safety of society, software engineers should adhere to the following Eight Principles:

Society: Software engineers will act in a manner consistent with the social interest.

Client and Entrepreneur: software engineers will act in a way that produces the best result for client and entrepreneur, and in a manner consistent with the social interest.

Product: Software engineers will ensure that their products and corresponding modifications meet the highest possible professional standards.

Valuation: software engineers will maintain integrity and independence in their professional valuations.

Management: Software engineering leaders and managers will subscribe and promote an ethical approach in software development and maintenance management.

Profession: software engineers will advance in the integrity and reputation of the profession, to drive consistent with the social interest.

Partners: Software engineers will be fair and support their partners.

Staff: Software engineers will participate in continuous learning regarding the practice of their profession and will promote an ethical approach to the practice of the profession.

3 0
3 years ago
Write a C program to find the sum of 10 non-negative numbers entered by user​
valentina_108 [34]

Answer:

Explanation:

#include <stdio.h>

void main()

{

   int  j, sum = 0;

   printf("The first 10 natural number is :\n");

 

   for (j = 1; j <= 10; j++)

   {

       sum = sum + j;

       printf("%d ",j);    

   }

   printf("\nThe Sum is : %d\n", sum);

}

8 0
3 years ago
Other questions:
  • Summarize the five stages of cultural shock
    11·2 answers
  • The text help readers understand the relationship between gender and sports?THESE PUMPKINS SURE CAN KICK!
    6·1 answer
  • Describe at least three virus scanning techniques
    13·1 answer
  • PACIFIC NORTHWEST
    10·1 answer
  • Why do you think there is a cross and a tick on these Logo designs below? Explain your answer below.
    15·1 answer
  • FIRST TO Answer for free brainlest. GOG GOGOGO
    6·1 answer
  • Luis saves an attachment that he received from Kevin. Where will the attachment save by default?
    5·1 answer
  • What the central difference between negative and positive politeness?
    13·2 answers
  • Change the file name for index.html to index.php
    12·1 answer
  • Write a loop that continually asks the user what pets the user has until the user enters stop, in which case the loop ends. It s
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!