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 a neuromorphic chip?
Dominik [7]

Answer:

A neuromorphic computer is a machine comprising many simple processors / memory structures (e.g. neurons and synapses) communicating using simple messages (e.g. spikes). ... Neuromorphic computing systems excel at computing complex dynamics using a small set of computational primitives (neurons, synapses, spikes).

Explanation:

The structure of neuromorphic computers makes them much more efficient at training and running neural networks. They can run AI models at a faster speed than equivalent CPUs and GPUs while consuming less power. This is important since power consumption is already one of AI's essential challenges.

3 0
3 years ago
When computer networks are connected to each other, the system is called a(n) ____.
KiRa [710]
LAN - Local area network :P
5 0
3 years ago
By using password-stealing software, ________ capture what is typed on a keyboard and easily obtain enough personal information.
wariber [46]

Answer:

B) Keyloggers

Explanation:

Keyloggers are malicious softwares used by hackers to secretly record and capture keystrokes on a person's computer when they are using it. This enables the hackers steal sensitive data like passwords, bank details, address etc. Keyloggers are one of the oldest forms of cyber threats used by cybercriminals to spy on unsuspecting users. Keyloggers can be sent through links to access. computer o directly installed with access to the computer.

5 0
3 years ago
Pamela finds that she is constantly spelling the word “color” as “colour” when she is typing. Even though this is how the word i
Oduvanchick [21]
She can hit always replace

7 0
3 years ago
Read 2 more answers
Answer the questions given below, share your ideas.Use the space for your answer.
Bess [88]

Answer:

I would get rid of the machine and well

8 0
2 years ago
Other questions:
  • Identifying what you will need to review takes place during?
    8·2 answers
  • An advertiser who sells coffee beans adds the keyword "Java'" to an ad group. After two weeks, she runs a placement performance
    11·1 answer
  • In information systems, _____ is information from a system that is used to make changes to input or processing activities.
    6·1 answer
  • Por favor alguem poderia me falar qual PC e melhor: Computador Gamer Fox PC FPS Intel Core i5 8GB (GeForce GTX 1050Ti 4GB GDDR5)
    15·1 answer
  • Which of these Logic Statement's are correct for the following diagram? *
    5·1 answer
  • HELP FAST PLEASE
    6·1 answer
  • Select the correct answer from each drop-down menu. The following diagram shows four resistors. What is the effective resistance
    9·1 answer
  • Write any two rules for writing algorithm​
    10·1 answer
  • What product use programmable control?
    11·1 answer
  • You would like to see only the last 15 lines of /home/user/log file on your linux machine. Which command line interface (cli) co
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!