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
charle [14.2K]
3 years ago
12

A function defined beginning with void SetNegativesToZeros(int userValues[], ... should modify userValues such that any negative

integers are replaced by zeros. The function _____.
Computers and Technology
1 answer:
Stels [109]3 years ago
3 0

Answer:

   public static void setNegativesToZero(int userValues[]){

       System.out.println("Array before setting negatives to zero "+Arrays.toString(userValues));

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

           if(userValues[i]< 1){

               userValues[i] = 0;

           }

       }

       System.out.println();

       System.out.println("Array After setting negatives to zero "+Arrays.toString(userValues));

   }

Explanation:

Using Java programming Language, the method is created to receive an array of ints as parameter (as specified in the question)

Using a for loop, we iterate over the entire array checking for values that are negative (<0) and setting them to zero.

See a complete program below

import java.util.Arrays;

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

   // Create an array and assign values

       int [] arr = {1,2,3,-1,1,2,-4};

   //Calling the method setNegativesToZero

   setNegativesToZero(arr);

   }

//Creating the Method

   public static void setNegativesToZero(int userValues[]){

       System.out.println("Array before setting negatives to zero "+Arrays.toString(userValues));

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

           if(userValues[i]< 1){

               userValues[i] = 0;

           }

       }

       System.out.println();

       System.out.println("Array After setting negatives to zero "+Arrays.toString(userValues));

   }

}

You might be interested in
In saving a Visual Basic project properly , which of the following: two components part are involved ?
alina1380 [7]

Answer:

C) Project and Form

Explanation:

In saving a Visual Basic project properly, the following: two components part that is involved are:

1. Project - this is the project file that will be saved in the computer's memory. On the toolbar of a Visual Basic Editor, there is a "Save Project File" icon, which will be clicked to save a Project file.

2. File - the is the Visual Basic Editor's user interface. Just like "window" in Microsoft Office, it is the space used in writing or building the project file.

4 0
2 years ago
Jack, a skillful hacker targeted a major banking services firm located in Japan, using the LOIC (Low Orbit Ion Cannon) tool, Jac
Elenna [48]

Answer:

denial-of-service attack (DoS attack) and distributed denial-of-service attack (DDoS attack)

Explanation:

Denial-of-service attack -

It is a type of cyber attack , where the hacker can create a machine or any network resource , which is capable to disrupt the server of the host , with the help of the internet , is referred to as the denial of service attack .

The task is accomplished with by flooding the host with many superfluous requests , which can overload the system .

In case of the distributed denial-of-service attack , the flooding is done by many different sources .

Hence , from the given scenario of the question ,

The correct answer is  denial-of-service attack (DoS attack) and distributed denial-of-service attack (DDoS attack) .

4 0
3 years ago
All of the following are ways to improve the mobile experience for a website visitor EXCEPT:
Jobisdone [24]

Answer:

Adding more links to the page.

Explanation:

User experience design, UED, is a concept or a process of software development application life cycle that graphically presents a clients project to reflect the needs, want and interactivity of the users.

There are certain principles that governs the design of user interactive web and mobile interfaces. A user interface has to be simple, easy to interact with, give a good feel, signing into email, phone, laptop, mobile app etc, should also be made easy.

Covering the screen with link, makes it difficult to navigate without triggering a link.

3 0
3 years ago
The filter feature in excel allows you to look at what Data?
madam [21]

For applying the filter you need to select the data on which you want to apply it so it will allow you to look at only data you select from the filter options.

4 0
2 years ago
The U.S. National Institute of Standards and Technology defines the incident response life cycle as having four main processes:
GuDViN [60]

Answer:

C. Post-incident activity.

Explanation:

An incident is a event of intrusion or attack or violation of an attempt of an attack. An incident response is an opposing response to an attack or violation.

An incident response life cycle are stages followed to mitigate a current attack or violation. The stages of the incident response life cycle are, preparation, detection and analysis, containing and eradicating and recovery, and post incident activity.

7 0
3 years ago
Other questions:
  • How can you find Web pages that contain news published during the past week?
    8·1 answer
  • Search engines that search other search engines are called
    12·2 answers
  • Net Worth is equal to assets minus liabilities. Which event will have the greatest impact (positive or negative) on one's net wo
    9·1 answer
  • What port in your computer will you use to plug in your camera?
    14·2 answers
  • 1. cybersquatting refers to the tampering of existing web sites and selling unrelated products (true or false)
    8·1 answer
  • Laxmi was not confident that she could learn to program a computer. When she found out that two girls with similar GPA’s in her
    5·1 answer
  • Give an example of a situation in which a compromise of Confidentiality leads to compromise in Integrity.Situation where confide
    8·1 answer
  • What is the range for copper tape
    15·1 answer
  • Write a script that checks to see if at least one argument has been given on the command line and tests whether the argument is
    5·1 answer
  • How do you delete questions you asked?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!