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
Which software application would you use to calculate and manipulate numerical data?
Basile [38]
The Software App That I Would Use Would Be NumericalDataHelp.com ... I Use that all the time ... If you cant find it just search in Google or Firefox Numerical Data Help and then you should be able to find some help there ... I hope that this helped !!! If it did mark me brainiest 
5 0
2 years ago
Describe the object-oriented software engineering approach.
Jobisdone [24]

Answer:

 The object oriented software engineering approach is basically focus on the attention for capture the given structure and conduct the data frameworks in the form of small module which consolidates the information and the procedure.

The principle and aim of the Object Oriented Design (OOD) is that improving the quality of the system analysis and increase its productivity and more usable efficiently.

There are different phases in the object oriented software engineering approach are as follows:

  • Firstly, we start analyze and define the particular system
  • Then, construct the analysis model based on the above approach of the specific system.
  • We verify the correctness of the system by using the testing.

3 0
3 years ago
A window frame will expand to fill the entire desktop when you
natima [27]
A. Sometimes it is marked by outwards pointing arrows (<= =>) with the reverse (collapsing so as to not take up the whole screen) being in the same spot, marked by inwards arrows (=> <=)
8 0
2 years ago
Which key combination will allow users to move to the top of a document? Ctrl+Page Down Ctrl+Home Shift+Home Shift+Page Up
Nonamiya [84]
It would be Ctrl+Home
5 0
3 years ago
Read 2 more answers
You need to connect two computers for a customer. The customer does not have a network and does not wish to purchase a concentra
SIZIF [17.4K]

Answer:

Crossover Cable

Explanation:

In networking, If two computers have same specifications and need to be connected then the only thing that is required is known as crossover cable. This cable is used to connect two computer of same types without using hub or switch.

7 0
3 years ago
Other questions:
  • If you plan on operating several applications at s time, the amount of RAM should be considered when purchasing a computer
    10·2 answers
  • Help please?
    10·1 answer
  • When did economies begin?
    11·2 answers
  • When a Python program is reading a file, the data is input as plain ASCII characters in a string. What is the following code doi
    15·1 answer
  • Why would you use quotation marks in a search string when conducting an internet search?
    12·1 answer
  • Default tab stops are set in word every ___________ inch.
    12·1 answer
  • Which option on the Format tab is used to modify particular portions of the chart?
    12·1 answer
  • Assuming that s and t are Strings, which of the following code fragments are such that the value returned by s.indexOf( t ) befo
    6·1 answer
  • Question 1 of 10 Which type of information systems personnel are involved in organizing information so that users can access it
    7·1 answer
  • A. A set of electronic program that makes of computer perform tasks
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!