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
USPshnik [31]
3 years ago
5

Write a recursive method that receives a string as a parameter and recursively capitalizes each character in the string (change

a small cap to a large cap, e.g. a to A, b to B, etc) as following: capitalize the first letter from the string, then calls the function recursively for the remainder of the string and in the end, build the capitalized string. For example, for "java", will capitalize the first letter to "J"(base case), calls the method recursively for the reminder of the string "ava" (reduction), and after recursion/reduction is over it and returns "AVA" will build a new string from "J" and "AVA" and return "JAVA" to the calling method.
Write this algorithms in java source code plz.
Computers and Technology
1 answer:
Alexxandr [17]3 years ago
4 0

Answer:

String words[]=str.split("\\s");  

String capitalizeWord="";  

for(String w:words){  

   String first=w.substring(0,1);  

   String afterfirst=w.substring(1);  

   capitalizeWord+=first.toUpperCase()+afterfirst+" ";  

}  

return capitalizeWord.trim();  

Explanation:

Define the word you are trying to capitalize and split it into an array.

String words[]=str.split("\\s");

Create a string for the capital output to be created as

String capitalizeWord="";  

Capitalize the word using the "first.toUpperCase()" and "afterfirst" functions

for(String w:words){  

   String first=w.substring(0,1);  

   String afterfirst=w.substring(1);  

   capitalizeWord+=first.toUpperCase()+afterfirst+" ";  

}  

You might be interested in
What value will the variable x have when the loop executes for the first time?
tia_tia [17]

The value that x will return when it runs the above loop for the first time is Tom. It is to be noted that the above code is JavaScript.

<h3>What is a JavaScript?</h3>

JavaScript is an object-oriented computer programming language that is used for the creation of effects that are interactive.

Scripts that are written using Java Programming Language can be used to control multimedia, create animated images, control how websites behave etc.

Java is also used in the creation of Games and many more.

Learn more about JavaScript at:
brainly.com/question/16698901

6 0
2 years ago
Write 4 types of network_based<br>on geographical area covered<br>by them​
ikadub [295]

Answer:

Network based coverages are LAN, WAN, MAN and WLAN

4 0
3 years ago
Flash drive DVD and hard drive are all examples of
oee [108]

Answer:

flash drive DVD and hard drive are all examples of storage device

8 0
3 years ago
Read 2 more answers
5. Write a program to remove any duplicate letters from a word and display the new word maintaining the original order. For exam
dexar [7]

Answer:

word = input('Enter a single word: ', 's');

n = length(word);

nodupWord = [];

for i = 1:n

  dup = false;

  c = word(i);

  for j = 1:i-1

      if word(j) == c

          dup = true;

          break;

      end

  end

  if ~dup

      nodupWord = [nodupWord, c]; %add the non-duplicate char to end

  end

end

disp(['Adjusted word: ', nodupWord])

Explanation:

The code is in Python.

3 0
3 years ago
Most job applications are online. true or false
Sonja [21]

Answer:

True

Explanation:

4 0
3 years ago
Other questions:
  • Aaron has elaborate systems set up on his computer to remind him of all the things he has to do and when he has to do them. The
    12·1 answer
  • Which organization has published more than 300 web standards
    7·1 answer
  • What type of Microsoft Server serves as an email server?
    7·2 answers
  • The data-mining technique that creates a report or visual representation is _____.
    13·1 answer
  • Which Windows feature allows secure printing over the Internet?​
    11·1 answer
  • Is there anything I can do to fix my laptop? It is a chrome book and my school provided it. Everything is still working.If anyon
    14·2 answers
  • The space that helps you organize your PowerPoint or Web Page is called ______.
    13·1 answer
  • Sube
    10·2 answers
  • How to run angular project from github.
    7·1 answer
  • Can any software run on any processor
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!