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
(EASY)
AnnyKZ [126]
If you go to a college website you will see the it has .edu in the URL extensions.
3 0
3 years ago
Read 2 more answers
Microsoft acknowledged that if you type a res:// url (a microsoft-devised type of url) which is longer than ____ characters in i
cluponka [151]
Which is longer than 20 characters
5 0
3 years ago
In terms of resource utilization, a /an application may require higher local
aksik [14]

Answer: A) Installed

Explanation: Installed application work on the system on which they are installed .They are supposed to persist the required speed of processing to execute the task ,enough memory and other resources as well to fulfill the need of the application functioning.

Other option is incorrect because cloud based application run with help of internet service via web browser so they resources in this applications based on the internet connectivity and browser's speed .Thus, the correct option is option(A).

3 0
3 years ago
Give four characteristics of hard disk​
Lubov Fominskaja [6]

Answer:

1. Mass Storage Devices

2. Available Storage Space

3. Data Access Performance

4. Device Form Factor and Connection

3 0
3 years ago
Part of implementing Ken 7 Windows Limited new enterprise resource planning (ERP) software is ensuring all workstations and serv
spayn [35]

Answer:

Explanation:

1) The Functions a software application provide to keep a web browser secured includes:

a) The web browser should always be updated, you can keep it on "automatic update" option enable on your browser settings so that it will be automatically updated whenever the browser gets an update.

b) Always keep the third party cookies disabled because of the many unauthorized and phishing sites over the internet. This leaves the browser unsafe and cause higher security risk so block all the third party sites and cookies from the browser.

2) The Functions a software application prohibit to keep a web browser secured includes:

a) Do not store passwords on your web browser, deny the "store password" option on your browser settings. This is very important Even if you store passwords on your web browser do set a very strong master password to access all the stored passwords.

b) Don't ever click on unwanted and unknown hyperlinks. There will be many unsolicited attachments, files, etc over the internet please do not open or download it unnecessarily.

3) The functions a software application should provide to keep a web server secured includes:

a) Always using an application scanner. Whenever you install or download any new applications, scan the application before accessing it or opening it.

b) Install all the security patches to keep off hackers as they are many on the internet.

4) The Functions a software application should prohibit to keep a web server secured includes:

1) Uninstall an application that has not been used for long time, because they are actually of no use.

b) There may be scripts, files, setups, codes stored on the web server unknowingly so do check it and delete all the sample scripts, files and codes from the web server.

3 0
3 years ago
Other questions:
  • Using a database of precomputed hashes from sequentially calculated passwords called a(n) __________, an attacker can simply loo
    14·1 answer
  • Points!!!!!!!! pls help
    13·2 answers
  • A technician is configuring a new SOHO multifunction wireless router at a customer's location to provide network access to sever
    7·1 answer
  • What does it mean to say that two variables are negatively correlated?
    6·1 answer
  • 2
    11·1 answer
  • Write a program that asks for the names of three runners and the time, in minutes (no seconds, etc.), it took each of them to fi
    7·1 answer
  • Suppose there are two hosts, S and R. They are communicating over a TCP connection, and R has already received from S al bytes f
    11·1 answer
  • In a flashdisk wich icon can you use to open files in computer​
    5·1 answer
  • You are network administrator for an Active Directory forest with a single domain. Then network has three sites with one domain
    12·1 answer
  • Your friend just gave you his old laptop. Whenever you turn on the laptop, though, a black screen appears and asks you to enter
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!