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
When we focus on stereotypes we may ___________________. a. experience culture shock b. develop ethnocentrism c. unconciously lo
alisha [4.7K]
When we focus on stereotypes we may <span>unconsciously look for information to support our generalizations .</span>
3 0
2 years ago
Read 2 more answers
Enables you to navigate through pieces of information by using links which connect them.
anyanavicka [17]
I believe your answer would be Hypertext. 

Hypertext is a t<span>ext that contains links to other text and 'enables you to navigate through pieces of info by using the links that connect them'; it is also used to navigate the World Wide by using hyperlinks.

Hope I helped :)</span>
3 0
3 years ago
An independent frame that holds a program, document, or folder contents in windows 7 is called a ____.
svetlana [45]
Window.

Have a wonderful day!~
7 0
3 years ago
Create a method called nicknames that passes an array as a parameter. Inside the method initialize it to hold 5 names of your ch
Gre4nikov [31]
<h2>Answer:</h2>

    //======METHOD DECLARATION=========//          

    //method name: nicknames                                          

    //method return type: void                                            

    //method parameter: an array reference                    

    public static void nicknames(String [] names){      

       //initialize the array with 5 random names              

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       //using an enhanced for loop, print out the elements in the array

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

<h2>Explanation:</h2>

The program is written in Java. It contains comments explaining important parts of the code. Kindly go through these comments.

A few things to note.

i. Since the method does not return any value, its return type is <em>void</em>

ii. The method is made public so that it can be accessible anywhere in and out of the class the uses it.

iii. The method is made static since it will most probably be called in the static main method (at least for testing in this case)

iv. The method receives an array of type <em>String </em>as parameter since the names to be stored are of type <em>String</em>.

v. The format of initializing an array manually should follow as shown on line 7. The <em>new</em> keyword followed by the array type (String), followed by the square brackets ([]) are all important.

vi. An enhanced for loop (lines 9 - 11) is a shorthand way of writing a for loop. The format is as follows;

=> The keyword <em>for</em>

=> followed by an opening parenthesis

=> followed by the type of each of the elements in the array. Type String in this case.

=> followed by a variable name. This holds an element per cycle of the loop.

=> followed by a column

=> followed by the array

=> followed by the closing parenthesis.

=> followed by a pair of curly parentheses serving as a block containing the  code to be executed in every cycle of the loop. In this case, the array elements, each held in turn by variable n, will be printed followed by a space.

A complete code and sample output for testing purposes are shown as follows:

==================================================

public class Tester{

    //The main method

    public static void main(String []args){

       

       String [] names = new String[5];

       nicknames(names);

    }

   

  //The nicknames method

    public static void nicknames(String [] names){

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

}

==================================================

<h2>Output:</h2>

John Doe Brian Loveth Chris

<em>NB: To run this program, copy the complete code, paste in an IDE or editor and save as Tester.java</em>

6 0
2 years ago
Which of the following is true of mobile commerce (m-commerce) applications? a. They are supported by short-range wireless commu
KATRIN_1 [288]

Answer:

Option A: They are supported by short-range wireless communication technologies.

Explanation:

M-commerce is a progression of e-commerce which is being used on vast scale now-a-days like in online shopping, online payments etc.

  • As m-commerce applications have facilitated so much, they also support short ranged communication technologies such as Bluetooth which allows the connectivity to internet as well as offers sharing among different devices.
  • m-commerce applications are also compatible with 3G and 4G and even they have been promoted in a remarkable way. As these generations provide much faster speed and better connection, they have added much more to the business.
  • m-commerce applications don't rely on voice recognition or text-to-text speech as they bother not to know who actually is interested. They rather make sure of payment methods to make the payments secure and certain.
  • The m-commerce is totally free from wired protocols as it uses handheld devices including cell phones, tablets or laptops. So that the mobility is ensured.
5 0
3 years ago
Other questions:
  • Casting is one of the oldest known manufacturing processes. <br> True or false
    6·2 answers
  • I just started game development using unity, I’m trying to control my sphere moving on a flat surface using the W,A,S,D keys, if
    11·1 answer
  • The times per second an audio file is converted from analog to digital is the ______. audio file format bandwidth sample rate wa
    5·2 answers
  • _____ separation strategies (e.g., attacking and sabotaging others) are used by those for whom co-cultural segregation is an imp
    5·1 answer
  • A binary message consisting of four bits was sent to you by a friend. The message was supposed to be ABAB. Unfortunately, your f
    8·1 answer
  • Write a program in c++ that plays a number guessing game with a Human user. The Human user will think of a number between 1 and
    7·2 answers
  • What is 36 Denary in Binary?? PLEASE ANSWER I WILL GIVE U BRAINLY!!
    9·2 answers
  • Which feature allows you to copy attributes of
    11·1 answer
  • I need advice, please try to give a full paragraph and include a p r o s and c o n s list, no l i n k s please, it would mean so
    8·1 answer
  • To print a square of star shaoe we use the following code:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!