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
Serhud [2]
3 years ago
14

Write a public member function which replace that replaces one occurrence of a given item in the ArrayBag with another passed as

an argument. The method should return a boolean to indicate whether the replacement was successful.
Computers and Technology
1 answer:
ira [324]3 years ago
5 0

Answer:

The method is written in Java

public static boolean abc(int [] ArrayBag,int num, int replace){

    Boolean done = false;

    for(int i =0; i<ArrayBag.length;i++){

        if(ArrayBag[i] == num){

            ArrayBag[i] = replace;

            done = true;

        }

    }

    for(int i = 0;i<ArrayBag.length;i++){

        System.out.println(ArrayBag[i]+" ");

    }

    return done;

}

Explanation:

The method is written in java

The arguments of the method are:

<em>1. ArrayBag -> The array declares as integer</em>

<em>2. num -> The array element to check the presence</em>

<em>3. replace - > The replacement variable</em>

This line defines the method as boolean.

public static boolean abc(int [] ArrayBag,int num, int replace){

This line declares a boolean variable as false

    Boolean done = false;

The following iterates through the elements of the array

    for(int i =0; i<ArrayBag.length;i++){

This checks if the array element exist

        if(ArrayBag[i] == num){

If yes, the array element is replaced

            ArrayBag[i] = replace;

The boolean variable is updated from false to true

            done = true;

        }

    }

The following iteration prints the elements of the array

<em>     for(int i = 0;i<ArrayBag.length;i++){</em>

<em>         System.out.println(ArrayBag[i]+" ");</em>

<em>     }</em>

This prints returns the boolean thats indicates if replacement was done or not.

    return done;

}

<em>Attached to this solution is the program source file that includes the main method of the program</em>

Download txt
You might be interested in
A security operation center (SOC) analyst investigates the propagation of a memory-resident virus across the network and notices
masya89 [10]

A type of virus that influences this circumstance in the network bandwidth is a worm.

<h3>What is Virus in technology?</h3>

In computers and technology, viruses may be characterized as a sort of malicious software, or malware, that extends between computers and provokes a deterioration of data and software either partially or completely.

The complete question is as follows:

  • A micro virus
  • a multipartite virus
  • A worm
  • a program virus.

Worms are memory-resident viruses that duplicate over the network resources. The primary consequence of this type of virus is to rapidly eradicate network bandwidth with its duplication.

This virus may also be competent to accomplish a Denial of services invasion by slamming O.S and servers.

Therefore, the correct option for this question is C, i.e. a worm.

To learn more about Computer viruses, refer to the link:

brainly.com/question/26128220

#SPJ1

5 0
2 years ago
What is the process viewing files in chrome web browser cache?
Andreyy89

Step 1. Click the address bar at the top of your Google Chrome window, type "About: cache" into the box and press "Enter." A page will appear with a list of cached files and their addresses.

Step 2. Press the "Ctrl" and "F" keys on your keyboard at the same time to open the find bar.

Step 3. Type part of the name or address of a cached file into the find box and press "Enter" to find it. Continue pressing "Enter" to page through any matching results.

Step 4. Select the full address of the cached file on the page with your mouse and press "Ctrl" and "C" at the same time to copy the address.

Step 5. Click the address bar, press "Ctrl" and "V" at the same time to paste the address and press "Enter" to load the file. Chrome loads the file from the cache.

Step 6. Right-click the image, page or script and select "Save As" to save the cached file to your computer.

6 0
3 years ago
Chemical equations of Carbon + water​
Setler79 [48]

Answer:

Aqueous carbon dioxide, CO2 (aq), reacts with water forming carbonic acid, H2CO3 (aq). Carbonic acid may loose protons to form bicarbonate, HCO3- , and carbonate, CO32-. In this case the proton is liberated to the water, decreasing pH. The complex chemical equilibria are described using two acid equilibrium equations.

PLS MARK AS BRAINLIEST

8 0
3 years ago
What was the basic invention that has evolved into the modern automobile?
anygoal [31]

Answer:

I would say Henry Ford's invention; the Ford car company, since we still have Ford cars running nowadays.

Explanation:

3 0
3 years ago
The __________ certification program has added a number of concentrations that can demonstrate advanced knowledge beyond the bas
Sophie [7]

Answer:

CISSP

Explanation:

The CIDDP concentrations are an extension and development on the knowledge and credentials of the standard CISS certification that improves employability and career advancement

The CISSP concentrations includes

Information System Security Architecture Professional which can be known as ISSAP

Information System Security Engineering Professional which can be known as ISSEP

Information System Security Management Professional which can be known as ISSMP.

4 0
3 years ago
Other questions:
  • What is an advantage of sharing documents in PDF format instead of Word format?
    6·2 answers
  • Load the titanic sample dataset from the Seaborn library into Python using a Pandas dataframe, and visualize the dataset. Create
    10·1 answer
  • Jennifer frequently uses a few programs on her laptop. Where will she find all the frequently used program icons in her computer
    13·1 answer
  • [17 PTS] What do you think of puzzle games?
    11·1 answer
  • if a second system failure occurs while the first recovery is in progress, what needs tobe done after the system recovers for th
    11·1 answer
  • Que es tarjeta madre resumen porfa
    13·2 answers
  • In order to preview an attachment in an e-mail, click the attachment in the ______
    8·1 answer
  • The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound. 1. Declare a const named CENTS_PER_POUND and initi
    12·1 answer
  • Which areas of a business would most benefit from using the Workday platform?
    7·1 answer
  • Which of these five are Netflix Originals?1/5
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!