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
disa [49]
3 years ago
7

Write a recursive method called repeat that accepts a string s and an integer n as parameters and that returns s concatenated to

gether n times. For example, repeat("hello", 3) returns "hellohellohello", and repeat("ok", 1) returns "ok", and repeat("bye", 0) returns "". String concatenation is an expensive operation, so for an added challenge try to solve this problem while performing fewer than n concatenations.
Computers and Technology
1 answer:
svp [43]3 years ago
6 0

Answer:

public static String repeat(String text, int repeatCount) {

   if(repeatCount < 0) {

       throw new IllegalArgumentException("repeat count should be either 0 or a positive value");

   }

   if(repeatCount == 0) {

       return "";

   } else {

       return text + repeat(text, repeatCount-1);

   }

}

Explanation:

Here repeatCount is an int value.

at first we will check if repeatCount is non negative number and if it is code will throw exception.

If the value is 0 then we will return ""

If the value is >0 then recursive function is called again untill the repeatCount value is 0.

You might be interested in
An office is facing a network issue. The technicians have determined that a virus affected the manager's computer. However, they
Margarita [4]

Answer:

The correct answer is: Bus Topology.

Explanation:

Bus Topology is a network setup where all the computers are connected to a single cable. Servers can connect easily to the network but it implies everyone connected has access to what everybody in the same network is doing. Security options are limited to no-existent under this topology.

In that case, if technicians cannot isolate a virus infection problem, it is the result of working with a bus topology where more than one computer is connected to the same network and every terminal has access to each terminal.

7 0
3 years ago
If the supply of computer engineers increases at the same time that the demand for these workers decreases, what would be the MO
stiv31 [10]

Answer:

Option C is correct.

Explanation:

When the supply of system engineers rises while demand for such workers falls at the similar period, Wages will drop while competition for employment rises.

According to the law of demand, when the supply of one commodity is increased then the demand for other commodity falls. So, the following option  C is correct according to the following scenario.

Other options are incorrect because they are not relevant according to the following scenario.

5 0
3 years ago
Computer World sells laptops separately from accessory products like docking stations, anti-virus software, and external hard dr
uysha [10]

Answer:

Optional product pricing

Explanation:

<em>Optional product pricing</em> occurs when a product is sold for a much lower price but complementary products or accessories are sold separately to generate profit.

A typical example is in the printer category, printer cartridges are sold separately from the printer when the one in the newly purchased printer runs out. The customer is forced to purchase new cartridges that the company benefits from as profits.

Optional product pricing is a strategy to provide less expensive technology while exploiting the frequent use of accessories to make a substantial profit.

6 0
3 years ago
Using the functions from problems 1 and 2, write a MATLAB script to compare the laminar results from to the turbulent results. C
suter [353]

To start combining, select the Merge Mode option on the Comparison tab. Next, click the button next to the line you wish to merge in order to replace content from the right pane with content from the left pane.

<h3>How is boundary layer thickness calculated?</h3>
  • Where x is a position parallel to the wall, y is a coordinate normal to the wall, v is a (small) viscosity, u = (u, v) is the velocity, is the vorticity, and so on. The boundary conditions are as follows: u(x,y = +,t) = U, and u(x,y = 0,t) = 0.
  • To gauge the overall pressure, a vertically sliding Pitot tube is employed. So that the growth of the boundary layer in the flow direction can be seen, the total pressures can be recorded at various distances from the plate surface. Static pressure is gauged at a different measurement location.
  • To start combining, select the Merge Mode option on the Comparison tab. Next, click the button next to the line you wish to merge in order to replace content from the right pane with content from the left pane. Alternatively, you can pick a discrepancy and choose Replace Content from the Comparison tab.        

To learn more about Boundary conditions refer to:

brainly.com/question/23802083

#SPJ4

6 0
1 year ago
The 169.254.78.9 ip address is an example of what type of ip address
scoundrel [369]
As specified in RFC5735, this is an address from the "link local" block. It is assigned to a network interface as a temporary address, for instance if no static address is configured and the DHCP server is not found.

If you boot your PC without a network cable, you'll probably end up with a 169.254.*.* address.
8 0
3 years ago
Other questions:
  • RADIAC instruments that operate on the ionization principle are broken down into three main categories based on what?
    15·1 answer
  • Which of these is outside the scope of an art director's responsibility?
    12·2 answers
  • Which set of steps will organize the data to only show foods with more than 100 calories and rank their sugar content from great
    8·1 answer
  • Unless grunkle stan pines is mistaken, there is a family of deer’s in his garden
    6·1 answer
  • Which of the follow will happen if you miss a monthly credit card payment?
    11·1 answer
  • WILL GIVE BRAINLIEST ANSWER!!!<br><br> How do you manage your screen time?
    8·2 answers
  • Graphics created within Illustrator CC are always vector graphics true or false
    9·1 answer
  • Which part of the brain controls the movement of muscles​
    6·1 answer
  • Write a program that reads a list of integers, and outputs whether the list contains all even numbers, odd numbers, or neither.
    6·2 answers
  • Which is NOT true?<br> 9 + 4 = 17 - 4<br> 8 + 7 = 14 + 3<br> 11 = 19 - 8<br> 5 + 8 = 20 - 7
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!