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
Paraphin [41]
3 years ago
13

Write a function named replaceSubstring. The function should accept three string object arguments entered by the user. We want t

o look at the first string, and every time we say the second string, we want to replace it with the third. For example, suppose the three arguments have the following values: 1: "the dog jumped over the fence" 2: "the" 3: "that" With these three arguments, the function would return a string object with the value "that dog jumped over that fence". Demonstrate the function in a complete program. That means you have to write the main that uses this.
Computers and Technology
1 answer:
Minchanka [31]3 years ago
4 0

Answer:

public class Main{

public static void main(String[] args) {

 System.out.println(replaceSubstring("the dog jumped over the fence", "the", "that"));

}

public static String replaceSubstring(String s1, String s2, String s3){

    return s1.replace(s2, s3);

}

}

Explanation:

*The code is in Java.

Create function called replaceSubstring that takes three parameters s1, s2, and s3

Use the replace function to replace the s2 with s3 in s1, then return the new string

In the main:

Call the replaceSubstring function with the given strings and print the result

You might be interested in
Which option for creating a table involves the use of a grid of squares?
SSSSS [86.1K]
It’s draw table iirc
4 0
3 years ago
Read 2 more answers
When you enforce restrictions, what must you do immediately?
sweet [91]
The answer is A create a password
4 0
3 years ago
Read 2 more answers
Do u like five nights at Freddy's? and is it good or bad?​
Murljashka [212]

Answer:

its bad

Explanation:

6 0
3 years ago
Read 3 more answers
Why is web arnea of so much commetition today
Sonja [21]

Answer:

try checking your internet or reset your computer if that still dosnt work try putting all your stuff on an USB stick and then after you did that factory data reset your computer and that should work but before you reset your computer take it into a computer specialist

Explanation:

8 0
3 years ago
The next scenarios are not part of the Java simulation. Just use your best thinking to answer the
umka21 [38]

Answer:

A) Vector is an upward, downwards, left, and right directions for Emily vector is in the upward, downwards, and right directions for Fran.

B) The force of weight and gravity in the downward direction, the normal force in the upward direction, acceleration force in the right direction and the frictional force in the left direction. Fran doesn't have a frictional force.

C) Emily's velocity will slow down since the ground is being countering her velocity and slowing her down in the opposite direction until she stops. Fran's speed will be constant since there is no friction to slow her down so she will continue to move unless she hits a wall.

Explanation:

3 0
3 years ago
Other questions:
  • How does technology improve productivity at home? (Select all that apply.)
    5·1 answer
  • 16.
    7·1 answer
  • Which one of the following items is an example of software?
    12·2 answers
  • Which best describes obliteration in a forged document?
    11·1 answer
  • You have several reference computers. The computers are configured to always start from a local hard disk drive. You plan to cap
    10·1 answer
  • Where is permanent data in the computer stored whenever gym starts his laptop He sees some commands in numbers appearing on the
    12·1 answer
  • Suppose a host has a 1-MB file that is to be sent to another host. The file takes 1 second of CPU time to compress 50%, or 2 sec
    12·1 answer
  • What other options are there besides jail for 16 year old that commit a crime?
    8·2 answers
  • Aside from human user types, there are non human user groups. Known as account types, __________ are implemented by the system t
    10·1 answer
  • 7. Accepting things that happen without trying to change them is known as
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!