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
Consider the following method:
RUDIKE [14]

Answer: b.

Explanation:

7 0
3 years ago
A network administrator is examining a RIPv2 routing table and notices that several subnets are advertised in individual entries
timama [110]

Answer:

Answer to the following question is to Use the auto-summary command.

Explanation:

Because with the implementations of the dynamic routing protocol, the RIP summarizes the networks at the classful boundary by default. Configure the router to automatically summarizes the networks, auto-summary command would be used.

An auto summarization is the features that allow the RIP(Routing Information Protocol) to summarizes its route to their the classful network automatically. For example, To consider that we are plan to use the eight subnets of the class B default the networks 172.16.0.0/16, subnet using three-bits subnetting.

5 0
3 years ago
What will the value of x be after the following statements execute? int x = 0; int y = 5; int z = 4; x = y z * 2;
Diano4ka-milaya [45]
Technically you'd get a compile error, due to the absence of a semi-colon after the forth statement (x = y z * 2; is invalid). Additionally, z * 2; is an invalid statement, as all programming languages that I know require you to specify the new value of z, such as (z = z * 2) or (z *= 2).

If we assume there's a semi-colon there, then the value of x after the following statements would be 5, as we are setting x's value to the value of y (which is 4), and x is never again modified in those statements.
3 0
3 years ago
A gamer typing their name into the computer is an example of:
vova2212 [387]

user input I think I'm not sure though

3 0
3 years ago
Read 2 more answers
Write a method named buildArray that builds an array by appending a given number of random two-digit integers. It should accept
saul85 [17]

Answer:

the code using Python

Explanation:

import random

def buildArray(array, size):

for i in range(size):

array.append(random.randint(10, 99))

def sumArray(array , num):

sum_array = 0

for i in range(num):

sum_array += array[i]

return sum_array

 

def main():

n = int(input("How many values to add to the array:\n"))

array = []

buildArray(array, n)

print(array)

 

num = int(input("How many values to find sum of array:\n"))

result= sumArray(array,num)

print(result)

 

main()

7 0
3 years ago
Other questions:
  • Tell me about a time when you had to use 3D thinking.
    13·1 answer
  • design the psuedocode for a program that allows a user to enter 10 numbers, then displays them in the reverse order of their ent
    6·1 answer
  • When the wires are connected to the terminals of the battery, what causes electric current in the circuit?
    15·1 answer
  • Value or power of a network grows exponentially as a function of the number of network members. this is known as ________ law.
    8·1 answer
  • A pair is a simple struct with two data members, one of type T1 and one of type T2. A set and a map are organized as binary sear
    10·1 answer
  • Write the C++ if statement that compares the contents of the quanity variable to the number 10. If the quantity variable contain
    12·1 answer
  • On an unweighted scale, a grade of A is worth _____ points
    7·1 answer
  • Derek’s supervisor is concerned that the company’s security system does not comply with the new standards the company has decide
    13·1 answer
  • Question :
    6·1 answer
  • During the morning of a website launch for a new government sponsored healthcare portal, an unknown political rival, individual,
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!