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]
3 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]3 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
What is bug in computer?​
Anton [14]

Answer:

<h2>A bug in a computer is refered to as a "computer virus" its where certain things on the computer or apps on it aren't working like they were designed to. </h2>

Explanation:

<h2>Hope this helps:)!</h2>
6 0
3 years ago
Which tool allows users to share code and also serves as a social networking
nikklg [1K]

Answer:

D. GitHub

Explanation:

A P E X

8 0
3 years ago
The _____ component of a database management system (dbms) is used to add, delete, modify, and retrieve records from a database.
ikadub [295]
The correct answer is:  [A]:  "data manipulation" .
________________________________________________________
3 0
4 years ago
Read 2 more answers
Students are studying the effects of beach pollution by counting populations of seagulls at two different beach locations. One l
KIM [24]

Answer:

The number of seagulls in each location.

Explanation:

Dependent variables are something that you are recording or measuring.

7 0
3 years ago
Sarah has to add a picture from her computer file and add a caption to it. Arrange the steps in a correct sequence.
SVEN [57.7K]
Click Insert
click Picture
click From File
select the desired picture and again click insert
right-click the picture
click Insert Caption
write the caption and add it
5 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following is the best definition of metatheatre?
    8·1 answer
  • Jabez needs to alert through an SMS text message those corporate users who have a specific brand and type of mobile device regar
    13·1 answer
  • What car Is this because I want it for my daughters sweet 16th birthday
    13·1 answer
  • The Go To feature can be accessed from which of the following dialog boxes?
    10·1 answer
  • What would be the state of the following list after each of the first four passes in a Bubble sort, sorting into ascending seque
    15·2 answers
  • In a school 50% of the students are younger than 10, 1/20 are 10 years old and 1/10 are older than 10 but younger than 12, the r
    7·1 answer
  • In attempts to improve their contribution to the environment a company decides to adapt green computing. Which of these techniqu
    13·1 answer
  • Why do you think viruses are called “viruses”? What do they have in common with the living viruses that cause diseases in humans
    6·2 answers
  • What is computer/why it is called data processor
    7·1 answer
  • Radio spectrum is the part of the complete range of electromagnetic waves that is used for radio communication from
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!