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
goldenfox [79]
2 years ago
11

Write a method called makeLine. The method receives an int parameter that is guaranteed not to be negative and a character. The

method returns a String whose length equals the parameter and contains no characters other than the character passed. Thus, if the makeLine(5,':') will return ::::: (5 colons). The method must not use a loop of any kind (for, while, do-while) nor use any String methods other than concatenation. Instead, it gets the job done by examining its parameter, and if zero returns an empty string otherwise returns the concatenation of the specified character with the string returned by an appropriately formulated recursive call to itself.
Computers and Technology
1 answer:
Cloud [144]2 years ago
5 0

Answer:

public static String makeLine (int n, char c) {

   if (n ==0)

return "";

   else

       return (c + makeLine(n-1, c));

}

Explanation:

Create a method called makeLine that takes two parameters, int n and char c

If n is equal to 0, return an empty string

Otherwise, call the method with parameter n decreased by 1 after each call. Also, concatenate the given character after each call.

For example, for makeLine(3, '#'):

First round -> # + makeLine(2, '#')

Second round -> ## + makeLine(1, '#')

Third round -> ### + makeLine(0, '#') and stops because n is equal to 0 now. It will return "###".

You might be interested in
How is photography like jazz music?
Wewaii [24]
LIke jazz, photography has fallings that are being implied to the pictures such as the jazz music. These felling or as there commonly know as soul can make great music and even HD pictures in photography.
7 0
3 years ago
As Jason walks down the street, a large raven starts squawking at him and flapping its wings. Jason thinks to himself ‘That bird
UNO [17]

Answer:

Answer to the following question is anthropomorphism.

Explanation:

Anthropomorphism is considered as the error in the following context of the scientific reductionism. Anthropomorphize is the source of an error that needs to reconsider.

Anthropomorphism is an attribute of the human qualities, emotions, thoughts, motivation, intentions, and characteristics to the non-living beings or the nonhuman beings, things or objects.

8 0
2 years ago
Where are some places that cyberbullying occurs? check all that apply
antiseptic1488 [7]

Answer:

social media like  snap chat twitter  and face book .it can even happen over email.or in school chats.

Explanation:

5 0
3 years ago
Read 2 more answers
What happens? In word 2016 when the home ribbon tab is clicked on ?
RideAnS [48]

When you clicked on the ribbon tab in word 2016, you'd be brought to the home tab, where all of the basic controls are displaced for you to see.

Hope I could help! :)

5 0
3 years ago
Read 2 more answers
How do i choose a most brainlyist
GuDViN [60]

Answer:

They’ll have to be 2 answers first, when 2 answers are given, you can choose which is branlyis. If there are no 2 answers, you can’t choose.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Which cisco ios command is used to display the current ospf neighbors and their rids?
    11·1 answer
  • Your car must have two red stoplights, seen from ______ feet in the daytime, that must come on when the foot brake is pressed.
    6·1 answer
  • Classes cannot:
    10·1 answer
  • How computer can affect the life of people?
    15·1 answer
  • Select each of the strategies you can use to be more efficient when using the Internet. using tabs creating tables creating book
    6·2 answers
  • Why, y did brainly just do that........or did it just happen to me
    12·2 answers
  • ¿porque y como surge la informatica y las computadoras
    13·1 answer
  • Mark is flying to Atlanta. The flight is completely full with 200 passengers. Mark notices he dropped his ticket while grabbing
    15·1 answer
  • You designed a program to create a username using the first three letters from the first name and the first four letters of the
    6·1 answer
  • What are some legal issues that can arise from the use of social media?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!