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
Identify a statement that accurately differentiates between short-term memory and working memory.
Veronika [31]

Answer:

Short term memory is in which a person may forgot very previously introduced knowledge, whereas working memory...well...works. Most people have working memory.

Explanation:

5 0
3 years ago
What was the original intention for the creation of ARPANET?
Anika [276]

ARPANET was the network that became the 'basis' for the Internet. It was based on a concept first published in 1967. It was developed under the direction of the U.S. Advanced Research Projects Agency (ARPA). In 1969, the idea became a modest reality with the interconnection of four university computers.

3 0
3 years ago
Read 2 more answers
Write the name of test for the given scenario. Justify your answer.
Snowcat [4.5K]

Answer:

Cevap b okey xx

Explanation:

Sinyorrr

8 0
3 years ago
_____ are like selection lists in which they limit fields to a set of possible values; but, unlike selection lists, the options
natali 33 [55]

Radio buttons exist like selection lists in which they limit fields to a set of potential values; but, unlike selection lists, the options appear as respective controls in the web form.

<h3>What is Radio button?</h3>

A radio button or option button exists as a graphical control element that permits the user to select only one of a predefined set of mutually exclusive options. The singular property of a radio button causes it distinct from checkboxes, where the user can select and unselect any numeral of items.

Radio buttons exist as a common way to permit users to make a single selection from a list of options. Since only one radio button can be selected at a period (within the same group), each available option must be its item and label. Radio buttons exist like selection lists in which they limit fields to a set of potential values; but, unlike selection lists, the options appear as respective controls in the web form.

To learn more about Radio button refer to:

brainly.com/question/20476366

#SPJ4

8 0
2 years ago
Why have countries requested for the removal of content?
Kipish [7]
These links should help u:
https://support.google.com/transparencyreport/answer/7347744?hl=en

https://searchengineland.com/most-censorship-and-content-takedown-requests-come-from-us-says-google-...
5 0
3 years ago
Other questions:
  • An ideal line length would include how many characters? A. 6570 B. 100 C. 100125 D. 4055
    8·1 answer
  • Anusha wants to use her computer,rather than handwriting the information on her notepad,to analyze her monthly expenses to make
    14·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    7·1 answer
  • CodeHS 3.4.5. What is the code for four colored triangles.
    8·1 answer
  • What is the quickest way to change the format of a table?
    8·1 answer
  • Most hand sewing begins and ends with
    5·1 answer
  • . Each ____ on a menu performs a specific action.
    14·1 answer
  • What is wrong with the following code?
    11·1 answer
  • What the difference between an operating system drive and a storage drive?
    6·1 answer
  • suppose one packet switches between a sending host and a receiving host. the transmission rates between the sending host and the
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!