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
AleksandrR [38]
3 years ago
9

Subtract each element in origList with the corresponding value in offsetAmount. Print each difference followed by a space. Ex: I

f origList = {4, 5, 10, 12} and offsetAmount = {2, 4, 7, 3},
print: 2 1 3 9
import java.util.Scanner;
public class VectorElementOperations {
public static void main (String [] args) {
final int NUM_VALS = 4;
int[] origList = new int[NUM_VALS];
int[] offsetAmount = new int[NUM_VALS];
int i;
origList[0] = 20;
origList[1] = 30;
origList[2] = 40;
origList[3] = 50;
offsetAmount[0] = 2;
offsetAmount[1] = 3;
offsetAmount[2] = 6;
offsetAmount[3] = 5;
*\your code here*\
System.out.print
Computers and Technology
1 answer:
mafiozo [28]3 years ago
7 0

Answer:

Replace

*\your code here*\

System.out.print

with the following lines code

int difference;

for(int j = 0; j<=3;j++)  {

difference = origList[j] - offsetAmount[j];

System.out.print(difference+" ");

}

Also, your program is  not well ended

At the end of the above code, write the following

}

}

Explanation:

The first line of the above code segment declares an integer variable named difference

The next line declares and starts a loop using an iterative variable named j

j is declared of type integer and it takes the range of 0 to 3

The next line calculates the difference between each element of array origList and the corresponding element of offsetAmount.

This difference is saved in variable difference

The next line prints the calculated difference followed by a blank space

The last line of the code segment ends the iteration

You might be interested in
What does a computer user need to know about programming in order to play a video game?
natita [175]

They don't need to know anything, because the video game is programmed by the person who made the game. You don't need to do any programming to play.

8 0
3 years ago
Read 2 more answers
Another name for the office button menu is the toolbar. true or false.
levacccp [35]
This statement is true im sure of it
8 0
3 years ago
Read 2 more answers
What is the role of a design tWhat is the role of a design tool in a Robotic Process Automation (RPA) solution?
marin [14]

Answer and Explanation:

Robotic Process Automation(RPA) are software tools that apply artificial intelligence(AI) technology to automate digital routine tasks for business executives. It mimics everyday tasks and automatically executes them for the user.

Design tools in RPA play the role of infusing the best design into RPA software, it works with the popular phrase "design thinking". Robotic process automation software are now in tune with the popular buzz of a user centered approach to design of RPA tools. This ideology focuses on deploying RPA software that appeals to users and are therefore market friendly.

4 0
3 years ago
Assign testResult with 1 if either geneticMarkerA is 1 or geneticMarkerB is 1. If geneticMarkerA and geneticMarkerB are both 1,
OverLord2011 [107]

Answer:

Following python statement will give the assignment to testResult as specified:

if((geneticMarkerA == 1) or (geneticMarkerB ==1)):

   testResult = 1

if((geneticMarkerA ==1) and (geneticMarkerB == 1)):

   testResult = 0

if((geneticMarkerA == 0) and (geneticMarkerB == 0)):

   testResult = 0

Explanation:

In above statements or and and operator are used to check the conditions of set of values present in variable geneticMarkerA and geneticMarkerB.

Based on if the condition evaluate to true or false respective values to testResult varaible is assigned.

Following is sample run for above statements:

geneticMarkerA = 1

geneticMarkerB = 0

if((geneticMarkerA == 1) or (geneticMarkerB ==1)):

   testResult = 1

if((geneticMarkerA ==1) and (geneticMarkerB == 1)):

   testResult = 0

if((geneticMarkerA == 0) and (geneticMarkerB == 0)):

   testResult = 0

print(testResult)

Output

1

4 0
4 years ago
What’s the process of observing someone actually working in a career that interests you?
Leni [432]

I think it's called shadowing, or job shadowing to be more specific.

7 0
4 years ago
Other questions:
  • What type of window are you opening when you click the Start button on the Windows desktop, and then click the name of an app
    9·1 answer
  • What is the size of the opening in the camera that the light passes through?
    9·2 answers
  • Program for bit stuffing...?
    9·1 answer
  • For a Windows laptop, what is the best way to save power when the computer will not be used for an extended period?
    14·2 answers
  • (01.05 LC)
    7·2 answers
  • I just wanna promote my 2 yt channels c: <br> (the channels are in the comments of this question)
    14·1 answer
  • PLEASE HELP ASAP IT'S DUE TODAY! WILL GIVE BRAINLIEST, FIVE STARS, AND THANKS!! PLEASE HELP!
    12·1 answer
  • Evaluating algebraic expressions 8(x+2)when x =6
    7·1 answer
  • D. Chipboard
    14·1 answer
  • What is a web browser​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!