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
Create a structure representing a student. The member variables should include student name, student ID, and four test grades fo
Neporo4naja [7]

Answer:

Output:

Name: Brainly

ID:0001

Write the 4 tests grades of the student separated by space :10 9 8 10

Brainly

0001

10 9 8 10

Average :9.66667

'1' to continue '0' to exit :

Explanation:

#include<iostream>

#include<string>

using namespace std;

//variables declaration

struct Student {

  string id; //string declaration ID

  string name; // string declaration name

  int grades[4]; //array of 4 because it is 4 grades

};

//definition of the function get information

void inputData(Student &s){

 

   

   cout << "Name:" ;

   getline(cin,s.name);

   cout << "ID:";

   cin >> s.id;

   cout << "Write the 4 tests grades of the student separated by space :";

   for (int i = 0; i<4; i++)

       cin >> s.grades[i];

}

//definition of the function of average

double inputAvg(Student s){

   double summation;

   int temporary;

   double average;

   for (int i = 0; i<4; i++){  

      for (int j = i; j<4; j++){

         if (s.grades[j] > s.grades[i]){

             temporary = s.grades[i];

             s.grades[i] = s.grades[j];

             s.grades[j] = temporary;

         }

      }

    }

    summation = 0;

    for (int i = 0; i<3; i++){

        summation = summation + s.grades[i];  

    }

    average = summation/3;

    return average;

}

void disp(Student *s){

   cout << s->name << endl;

   cout << s->id << endl;

   for (int i = 0; i<4; i++)

       cout << s->grades[i] << " ";

   cout << endl;

   cout << "Average :" << inputAvg(*s) << endl;

   

}

int main(){

  Student st;

  int ch;

  while(true){

      inputData(st);

      disp(&st);

      cout << " '1' to continue '0' to exit :";

      cin >> ch;

      if (ch == 0)

         break;      

  }

  return 0;

}

6 0
3 years ago
HOW CAN A PERSON GET BENEFITTED BY THE ICT BASEDSERVICES PROVIDED BY GOVERNMENT
BARSIC [14]

Answer:

Explanation:

It aims to transform the entire ecosystem of public services through the use of information technology.ICT holds particular promise in areas of governance and public participation.  Age can use information to reduce corruption and increase government transparency, accountability, efficiency and so finally gud night guys and take care.

plz mark as brainliest

5 0
3 years ago
Calculate the formula unit mass if Al(NO3)3.(Al=27,N=14,O=16)​
Sergio039 [100]

Answer:

Explanation:

EMAIL query ? comment or request a type of GCSE calculation not covered? ... atomic masses are Al = 27 and O = 16; so the relative formula mass RFM or Mr = (2 x 27) + (3 x 16) = 102

3 0
3 years ago
What certification is provided by an APMG-International
White raven [17]

Answer:

The answer is "Agile".

Explanation:

Agile is a kind of cooperation among inter-functional, autonomous teams to recognize needs and solutions, that provides you development, economic growth, and delivery and facilitates a time-based, adaptive approach, that makes for a fast and efficient reaction to change.

  • APM Group also use for an International body specializing in human, corporate and electronic accreditation and evaluation and testing schemes.
  • It was founded in 1990 and works daily continuously through two decades, and because of some reason, this certification is also known as Agile.
6 0
4 years ago
What is indentation?​
Vlad1618 [11]

Answer: may refer to: Indentation (typesetting), the placement of text farther to the right, or left, to separate it from surrounding text. Indentation style, in programming a convention governing the indentation of blocks of code to convey the program's structure.

Explanation:

5 0
3 years ago
Other questions:
  • Which best describes a VPN?
    14·2 answers
  • The medium format camera uses ___ film
    7·1 answer
  • 3k means about 3 thousand bytes. how would you express two hundred million bytes? .
    8·1 answer
  • A program is a high-level one that has been converted to machine language
    15·1 answer
  • 2. A well designed high-volume system will minimize _________ inventory and reduce _____________for the product or service. a) w
    7·1 answer
  • Which of the following is not System Software?
    5·1 answer
  • When should students practice netiquette in an online course? Check all that apply.
    9·1 answer
  • Tools used to type text on Ms -paint​
    10·1 answer
  • Consider the following method.
    14·1 answer
  • After a group sets a project schedule, members should be prepared to
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!