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
Blizzard [7]
3 years ago
8

Double any element's value that is less than controlValue. Ex: If controlValue = 10, then dataPoints = {2, 12, 9, 20} becomes {4

, 12, 18, 20}.
import java.util.Scanner; public class StudentScores { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int NUM_POINTS = 4; int[] dataPoints = new int[NUM_POINTS]; int controlValue; int i; controlValue = scnr.nextInt(); for (i = 0; i < dataPoints.length; ++i) { dataPoints[i] = scnr.nextInt(); } for (i = 0; i < dataPoints.length; ++i) { System.out.print(dataPoints[i] + " "); } System.out.println(); } }
Computers and Technology
2 answers:
Aleksandr [31]3 years ago
5 0

Answer:

import java.util.Scanner;

public class StudentScores

{

public static void main(String[] args) {

 Scanner scnr = new Scanner(System.in);

 final int NUM_POINTS = 4;

 int[] dataPoints = new int[NUM_POINTS];

 int controlValue;

 int i;

 controlValue = scnr.nextInt();

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

     dataPoints[i] = scnr.nextInt();

 }

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

     System.out.print(dataPoints[i] + " ");

 }

 System.out.println();

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

     if(dataPoints[i] < controlValue){

         dataPoints[i] = dataPoints[i] * 2;          

     }

     System.out.print(dataPoints[i] + " ");

 }

}

}

Explanation:

*Added parts highligted.

After getting the control value and values for the array, you printed them.

Create a for loop that iterates through the dataPoints. Inside the loop, check if a value in dataPoints is smaller than the contorolValue. If it is, multiply that value with 2 and assign it to the dataPoints array. Print the elements of the dataPoints

zhannawk [14.2K]3 years ago
5 0

Answer:

import java.util.Scanner;

public class numm3 {

   public static void main (String [] args) {

       Scanner scnr = new Scanner(System.in);

       final int NUM_POINTS = 4;

       int[] dataPoints = new int[NUM_POINTS];

       int controlValue;

       int i;

       System.out.println("Enter the control Variable");

       controlValue = scnr.nextInt();

       System.out.println("enter elements for the array");

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

           dataPoints[i] = scnr.nextInt();

       }

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

           System.out.print(dataPoints[i] + " ");

       }

       System.out.println();

       //Doubling elements Less than Control Variable

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

           if (dataPoints[i]<controlValue){

               dataPoints[i] = dataPoints[i]*2;

           }

           System.out.print(dataPoints[i] + " ");

       }

       System.out.println(); } }

Explanation:

See the additional code to accomplish the task in bold

The trick is using an if statement inside of a for loop that checks the condition (dataPoints[i]<controlValue) If true, it multiplies the element by 2

You might be interested in
¿Ha existido en la historia de nuestra humanidad alguien que hubiera hecho posible el sueño del ser humano en obtener energía li
elixir [45]

This question is incomplete, here´s the complete question.  

Leer "Energias libres: La verdad sobre Nicola Tesla", de Pedro Pozas Terrados.

¿Ha existido en la historia de nuestra humanidad alguien que hubiera hecho posible el sueño del ser humano en obtener energía libre y gratuita? ¿Quién y con cuál invento?

Answer: Nikola Tesla tenía un plan para desarrollar la transmisión inalámbrica de energía libre y gratuita.

Explanation:

El físico serbo-norteamericano estaba convencido de que la energía radiante podía proveer energía eléctrica libre y gratuita, tomando la energía directamente de la naturaleza.

Logró construir una torre de alta tensión que demostraría su teoría, el proyecto denominado “Wardenclyffe”, pero la falta de presupuesto lo llevó a ver su torre destruida y perder su hipoteca.

Es posible que durante su vida, e incluso despues de su muerte, cuando el FBI ocultó como secreto de estado su trabajo, haya sido el temor por parte de quienes se benefician del sistema económico detrás de la industria energética lo que impidió que su invento permitiera a la humanidad contar con energía libre y gratuita.

5 0
3 years ago
How do you get The gold chip on Megaman x3 snes I want To know
strojnjashka [21]

Answer:

no clue lol

Explanation:

5 0
2 years ago
Objective:This assignment is designed to give you experience with thinking about algorithm analysis and performanceevaluation.Pr
wolverine [178]

Answer:

Check the explanation

Explanation:

#include<stdio.h>

/*Function to return max sum such that no two elements

are adjacent */

int FindMaxSum(int arr[], int n)

{

 int incl = arr[0];

 int excl = 0;

 int excl_new;

 int i;

 for (i = 1; i < n; i++)

 {

    /* current max excluding i */

    excl_new = (incl > excl)? incl: excl;

    /* current max including i */

    incl = excl + arr[i];

    excl = excl_new;

 }

  /* return max of incl and excl */

  return ((incl > excl)? incl : excl);

}

/* Driver program to test above function */

int main()

{

 int arr[] = {5, 5, 10, 100, 10, 5};

 printf("%d \n", FindMaxSum(arr, 6));

 getchar();

 return 0;

}

7 0
2 years ago
In the year, , the American Department of Defense put a military research network, called ARPANET online.
mario62 [17]

Answer:

November 21st of 1969.

Explanation:

In the year, 1969, the American Department of Defense put a military research network, called ARPANET online.

3 0
2 years ago
Adrian wants to run a digital movie clip that his friend shared with him through email. His system has 2 GB of RAM and 20 GB of
bogdanovich [222]

Answer:

Adrian requires a high speed internet connection and a codec player to download and run movie on his system.

Explanation:

There are some basic requirements of the computers that, can be used to watch the movie on the computer.

1. RAM

2. Storage space to store the movie

3. High Speed Internet: As the movie is on the internet, to download it from internet, bandwidth and speed of internet is required.

4. Video Codec Player is required to play a digital movie on laptop or system.

3 0
2 years ago
Other questions:
  • HELP PLEASE
    7·2 answers
  • What test is most similar to binary​
    9·1 answer
  • Which flooring option is most economical
    11·1 answer
  • Dynamic alliance networks work best in industries: a. that are mature and stable in nature. b. where the coordination of product
    9·1 answer
  • If nothings faster than light then how do the dark get there first????
    5·2 answers
  • what are the benefits of VolP? select all that apply. A:cheaper printings B:clearer calls C: faster download D: increased effici
    11·2 answers
  • Brainliest for whoever adds me on snap<br> gianavaughn007
    15·2 answers
  • Write a java program to create and display unique three digit number using 1,2,3 and 4 also count how many three digit number ar
    10·1 answer
  • Question is in photo
    11·1 answer
  • In PowerPoint, a picture might be a photograph, a shape you draw, a piece of clip art, or an illustration created using a graphi
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!