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
fenix001 [56]
2 years ago
13

Multiply each element in origList with the corresponding value in offsetAmount. Print each product followed by a space.Ex: If or

igList = {4, 5, 10, 12} and offsetAmount = {2, 4, 7, 3}, print:8 20 70 36 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] = 4;offsetAmount[1] = 6;offsetAmount[2] = 2;offsetAmount[3] = 8;/* Your solution goes here */System.out.println("");}}

Engineering
1 answer:
n200080 [17]2 years ago
8 0

Answer:

Here is the JAVA program:  

import java.util.Scanner; // to take input from user

public class VectorElementOperations {

public static void main(String[] args) {

final int NUM_VALS = 4; // size is fixed that is 4 and assigned to NUM_VALS

int[] origList = new int[NUM_VALS];

int[] offsetAmount = new int[NUM_VALS];

int i;

//two lists origList[] and offsetAmount[] are assigned values

origList[0] = 20;

origList[1] = 30;

origList[2] = 40;

origList[3] = 50;

offsetAmount[0] = 4;

offsetAmount[1] = 6;

offsetAmount[2] = 2;

offsetAmount[3] = 8;

String product=""; // product variable to store the product of 2 lists

for(i = 0; i <= origList.length - 1; i++){

/* loop starts with i at 0th position or index and ends when the end of the origList is reached */

/* multiples each element of origList to corresponding element of offsetAmount and stores result in the form of character string in product*/

   product+= Integer.toString(origList[i] *= offsetAmount[i]) + " ";  }

 System.out.println(product); }}   //displays the product of both lists

Output:

80 180 80 400

Explanation:

If you want to print the product of origList with corresponding value in offsetAmount in vertical form you can do this in the following way:

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] = 4;

offsetAmount[1] = 6;

offsetAmount[2] = 2;

offsetAmount[3] = 8;

for(i = 0; i <= origList.length - 1; i++){

 origList[i] *= offsetAmount[i];

System.out.println(origList[i]); } }}

Output:

80                                                                                                                            

180                                                                                                                          

80                                                                                                                            

400

The program along with the output is attached as screenshot with the input given in the example.

You might be interested in
Does anyone know what this is​
sammy [17]

Answer:

Looks like mold that got frosted over

Explanation:

4 0
2 years ago
Read 2 more answers
What is the difference Plastic vs elastic deformation.
Reika [66]

Answer:

What is the difference Plastic vs elastic deformation

Explanation:

The elastic deformation occurs when a low stress is apply over a metal or metal structure, in this process, the stress' deformation is temporary and it's recover after the stress is removed. In other words, this DOES NOT affects the atoms separation.

The plastic deformation occurs when the stress apply over the metal or metal structure is sufficient to deform the atomic structure making the atoms split, this is a crystal separation on a limited amount of atoms' bonds.

8 0
2 years ago
A three-point flexure test is conducted on a cylindrical specimen of aluminum oxide. The specimen radius is 5.0 mm and the dista
kondaur [170]

Answer:

Detailed solution is given in the attached diagram

7 0
3 years ago
Consider the following relational database that Best Airlines uses to keep track of its mechanics, their skills, and their airpo
Musya8 [376]

Answer:

Explanation:

A)

SELECT MECHNAME,AGE FROM MECHANIC;

B)

SELECT AIRNAME,SIZE FROM AIRPORT WHERE SIZE>=20 AND STATE='CALIFORNIA' AND YEAROPENED >=1935 ORDER BY SIZE ASC;

C)

SELECT AIRNAME,SIZE FROM AIRPORT WHERE (SIZE>=20 OR YEAROPENED >=1935) AND STATE='CALIFORNIA';

D)

SELECT AVG(SIZE) FROM AIRPORT WHERE STATE='CALIFORNIA' AND YEAROPENED >=1935;

E)

SELECT COUNT(AIRNAME) FROM AIRPORT WHERE STATE='CALIFORNIA' AND YEAROPENED >=1935;

F)

SELECT COUNT(AIRNAME),STATE FROM AIRPORT WHERE YEAROPENED>=1935 GROUP BY STATE;

G)

SELECT COUNT(AIRNAME),STATE FROM AIRPORT WHERE YEAR OPENED>=1935 GROUP BY STATE HAVING COUNT(*)>=5;

H)

SELECT MECHNAME FROM MECHANIC A JOIN AIRPORT B

ON A.AIRNAME=B.AIRNAME AND B.STATE='CALIFORNIA';

I)  

SELECT MECHNAME FROM MECHANIC A

JOIN QUALIFICATION B

ON A.MECHNUM=B.MECHNUM

AND B.PROFRATE=4

JOIN SKILL C

ON B.SKILLNUM=C.SKILLNUM

AND SKILLNAME='FAN BLADE RELACEMENT';

J)  SELECT MECHNAME FROM MECHANIC A

JOIN QUALIFICATION B

ON A.MECHNUM=B.MECHNUM

AND B.PROFRATE=4

JOIN SKILL C

ON B.SKILLNUM=C.SKILLNUM

AND SKILL NAME='FAN BLADE REPLACEMENT'

JOIN AIRPORT D

ON A.AIRNAME=D.AIRNAME

AND STATE='CALIFORNIA';

K)   SELECT SUM(SALARY),CITY FROM MECHANIC A

JOIN AIRPORT B

ON A.AIRNAME=B.AIRNAME

AND STATE='CALIFORNIA'

GROUP BY CITY;

L)   SELECT MAX(SIZE) FROM AIRPORT ;

M)  SELECT MAX(SIZE) FROM AIRPORT WHERE STATE='CALIFORNIA';

6 0
2 years ago
Who ate cdonalds in hell with god then died from food ppoisoning
siniylev [52]

Answer:

McDonald’s announced recently that they are going through some major menu changes, and will be nixing some unnecessary ingredients. They also are finally listening to us, and will stop using chickens that are injected with growth-promoting antibiotics, along with dairy products raised with the growth hormone rbST but they still are using a lot of factory farmed meat and the beef is still raised with antibiotics.

McDonald’s even said they might add kale to their menu, by putting it in salads or in a smoothie. I LOVE kale, and I hope they don’t find a way to ruin it. You know the saying, “You can put lipstick on a pig, but it’s still a pig”. So, they need to do a lot more than just add kale to their menu before I’d ever eat there. The problem is that millions are still eating there and consuming several questionable food additives that McDonald’s could remove entirely if they really wanted to.

Explanation:

7 0
2 years ago
Other questions:
  • 1. True or False: When two batteries are wired in Series the Volts go up and the Amp Hours stay the same. 2. True or False: When
    6·1 answer
  • Create a document that includes a constructor function named Company in the document head area. Include four properties in the C
    7·1 answer
  • MCQ : What are the main the constituents of acid rains?
    10·2 answers
  • What are wheel cylinders used for?
    6·1 answer
  • A civil engineer is likely to fit in which of the Holland occupational codes?
    14·2 answers
  • During the pre-drive check, you'll want to observe the car from the _______.
    9·1 answer
  • 1. In order for a team to accomplish its goal(s), it is NOT important for the team members to
    14·2 answers
  • For many people in 3D modeling copyrights and licensing allow them to earn a living.
    12·1 answer
  • Who made the frist ever car
    13·2 answers
  • Although studs are sometimes spaced 24" O.C. in residential structures, a spacing of_____ O.C. is more commonly used.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!