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
Elements such as page parts and calendars are easily inserted by navigating to the _____ grouping. Building Blocks Illustrations
yaroslaw [1]

Answer:

Building Blocks

Explanation:

When referring to the Publisher Application the navigation feature that allows you to do this is the Building Blocks feature. Like mentioned in the question this feature allows you to choose from and insert a predefined set of calendars for insertion into a publication as well as insert a variety of other page parts to better customize the feel of the publication.

6 0
3 years ago
Design a program using ordinary pipes in which one process sends a string message to a second process, and the second process re
Dmitry [639]

Here's a solution in C#. Create two console applications, one for the client and one for the server. In the server, put this:

           Console.WriteLine("Listening to pipe...");

           var server = new NamedPipeServerStream("BrainlyPipe");

           server.WaitForConnection();

           var reader = new StreamReader(server);

           var writer = new StreamWriter(server);

           while (true)

           {

               var line = reader.ReadLine();

               if (!server.IsConnected) break;

               Console.WriteLine("Received: " + line);

               writer.WriteLine(ChangeCase(line));

               writer.Flush();

           }

To change case, add this function:

       public static string ChangeCase( string s)

       {

           var sb = new StringBuilder();

           foreach(char c in s)

               sb.Append(char.IsUpper(c) ? char.ToLower(c) : char.ToUpper(c));

           return sb.ToString();

       }

In the client, put this:

           var client = new NamedPipeClientStream("BrainlyPipe");

           client.Connect();

           var reader = new StreamReader(client);

           var writer = new StreamWriter(client);

           writer.WriteLine("Brainly question 13806153 demo");

           writer.Flush();

           Console.WriteLine(reader.ReadLine());

           Console.ReadLine();


5 0
3 years ago
The following code has which kind of error?
Mila [183]

Answer:

There would be a logic error.

Explanation:

The count for x should have been initialized before addint it to the variable total.

6 0
2 years ago
Kim's father's company has expanded many times. Therefore, the company's volume of data has also increased. The employees of tha
Flura [38]

B. LAN


She should choose the LAN because , its secured and wired. On LAN the huge amount of data can be transferred better than WLAN so the best option would be place LAN network for the employees to access the huge amount of data.

4 0
3 years ago
Read 2 more answers
give an example of both a negative and positive coping mechanism you could use to deal with this stress?
Andru [333]

Answer:

Negative coping mechanism deals with Substance dependence, abuse, and use; anger, violent mentality, risky mentality, dangerous mentality, reminders such as trauma, etc.

The positive coping mechanism can be like an attempt to transform or change the issue into something other than that. As an example, it can be like converting a stressful situation into a positive situation.

Explanation:

Please check the answer section.

4 0
3 years ago
Other questions:
  • Write down a recurrence relation for this version of QuickSort, and solve it asymp-totically. Show your work. Assume that the ti
    13·1 answer
  • You created a vm and installed windows server 2008 r2 over the network, using pxe boot. when you start the vm, it doesn't attemp
    7·1 answer
  • Getting access to web browsing software to install it on a computer or to update your existing software is called _________ .
    9·2 answers
  • A study guide can be created
    6·2 answers
  • Write a function called lucky_sevens that takes in one #parameter, a string variable named a_string. Your function #should retur
    15·1 answer
  • ______is a multimodal application software platform. the centrealized and shared database system ties the entire organization to
    10·1 answer
  • Jennifer stays fit by playing games that track the movement of her body. Which platform features such a physical interface featu
    15·1 answer
  • Describe three perimeter intrusion detection systems and give an example of one that you have seen deployed either at work or an
    8·1 answer
  • _______ make up the basic structure of a relational database with columns containing field data and rows containing record infor
    6·2 answers
  • What is the name of the function used to open a file in C?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!