answer.
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]
2 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]2 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
Which XP practice prescribes that "the code [always be] written by two programmers at one machine"?.
damaskus [11]

Answer:

Pair Programming

Explanation:

In Extreme Programming XP, pair programming is a practice in which two programmers work together in a pair at one machine, when writing a code.

One of the two programmers is called the "driver" or developer who writes the code and supervises all the changes made to the program.

The other one is called an "navigator" or observer who provides ideas on how the program should be written, observes or reviews it the program, identify the issues or errors in the code, help in code simplifications.

The two developers implements the program, do coding, review the program and check each other's work. They both are required to be equally skilled in order to implement and test the code. This improves the process of the software development. By working in a pair and reviewing and testing the code together, they develop a better code.

8 0
2 years ago
+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~
Karo-lina-s [1.5K]

+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.+10 POINTS AND BRAINLIEST!! HELP ME PLEASE!!~~~

Which statement describes what happens when a user configures No Automatic Filtering in Junk Mail Options?

No messages will ever be blocked from the user’s mailbox.

Messages can still be blocked at the server level.

Messages cannot be blocked at the network firewall.

Most obvious spam messages will still reach the client computer.

<em><u>please</u></em><em><u> </u></em><em><u>mark</u></em><em><u> </u></em><em><u>me</u></em><em><u> </u></em><em><u>as</u></em><em><u> </u></em><em><u>brainliest</u></em><em><u>. </u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

<em><u>follow</u></em><em><u> </u></em><em><u>me</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>my</u></em><em><u> </u></em><em><u>fr</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em><em><u>.</u></em>

6 0
2 years ago
A Salesforce administrator adding a recommendations carousel component in Community Builder. The page displays correctly in Comm
disa [49]

Answer:

The page changes with the recommendation component have NOT been published.

Explanation:

The community builders are generally used to identify different opportunities by utilizing the necessary creativity, analysis and strategies. This will ensure that the objectives are achieved at the end of the day. Based on the problem encountered during the operation, it shows that the necessary page changes were not published.

4 0
2 years ago
ArgumentException is an existing class that derives from Exception; you use it when one or more of a method’s arguments do not f
dybincka [34]

Answer:

The C# code is given below

Explanation:

using System;

public class SwimmingWaterTemperatur

{

public static void Main()

{

while(true){

Console.Write("\nPlease enter the water temperature : ");

int x = Int32.Parse (Console.ReadLine());

try{

if(CheckComfort(x)){

Console.Write(x+" degrees is comfortable for swimming.");

}else{

Console.Write(x+" degrees is not comfortable for swimming.");

}

}catch(Exception ex){

Console.WriteLine(ex);

}

}

}

public static Boolean CheckComfort(int temp){

if(temp>=70 && temp<=85){

return true;

}else if(temp>=32 && temp<=212){

return false;

}else{

throw new ArgumentException("Value does not fall within the exptected range.");

}

}

}

7 0
2 years ago
Define a function ComputeGasVolume that returns the volume of a gas given parameters pressure, temperature, and moles. Use the g
lara [203]

Answer:

double ComputeGasVolume(double pressure, double temperature, double moles){

   double volume = moles*GAS_CONST*temperature/pressure;

    return volume;        

}

Explanation:

You may insert this function just before your main function.

Create a function called ComputeGasVolume that takes three parameters, pressure, temperature, and moles

Using the given formula, PV = nRT, calculate the volume (V = nRT/P), and return it.

6 0
2 years ago
Other questions:
  • "use the ______ element to create logical areas on a web page that are embedded within paragraphs or other block formatting elem
    15·1 answer
  • A mistake programmers often make with loops is that they ____.
    15·1 answer
  • In a particular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters traveled. Write a func
    11·1 answer
  • 10) What is the BEST way to rewrite sentence (1) to make it more
    5·2 answers
  • A network design engineer has been asked to design the IP addressing scheme for a customer network. The network will use IP addr
    6·1 answer
  • Describe a situation involving making a copy of a computer program or an entertainment file of some sort for which you think it
    7·1 answer
  • When does the narrator of "EPIC 2015" say the "road to 2015" began?
    10·2 answers
  • Write a program findStr.c that finds the "smallest" and "largest" in a series of words. After the user enters the words, the pro
    9·1 answer
  • Write a program that has the following String variables: firstName, middleName, and lastName. Initialize these with your first,
    7·1 answer
  • Plz help code practice for python
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!