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]
3 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]3 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
1. ELECTRICAL SHOCK
lions [1.4K]
Here’s some of them
6. J
7. I
10. O
13. F
14. E
15. N
3 0
3 years ago
Consider the string length equal to 7. This string is distorted by a function f (x) = 2 sin(2x) - 10sin(10x). What is the wave f
fenix001 [56]

Answer:

hello your question has a missing part below is the missing part

Consider the string length equal to \pi

answer : 2cos(2t) sin(2x) - 10cos(10t)sin(10x)

Explanation:

Given string length = \pi

distorted function f(x) = 2sin(2x) - 10sin(10x)

Determine the wave formed in the string

attached below is a detailed solution of the problem

8 0
3 years ago
A hair dryer is basically a duct of constant diameter in which a few layers of electric resistors are placed. A small fan pulls
Inessa05 [86]

Answer:

the percent increase in the velocity of air is 25.65%

Explanation:

Hello!

The first thing we must consider to solve this problem is the continuity equation that states that the amount of mass flow that enters a system is the same as what should come out.

m1=m2

Now remember that mass flow is given by the product of density, cross-sectional area and velocity

(α1)(V1)(A1)=(α2)(V2)(A2)

where

α=density

V=velocity

A=area

Now we can assume that the input and output areas are equal

(α1)(V1)=(α2)(V2)

\frac{V2}{V1} =\frac{\alpha1 }{\alpha 2}

Now we can use the equation that defines the percentage of increase, in this case for speed

i=(\frac{V2}{V1} -1) 100

Now we use the equation obtained in the previous step, and replace values

i=(\frac{\alpha1 }{\alpha 2} -1) 100\\i=(\frac{1.2}{0.955} -1) 100=25.65

the percent increase in the velocity of air is 25.65%

6 0
3 years ago
Why does a foil airplane fly farther than a paper one?
Free_Kalibri [48]

Answer:

the reason paper airplanes fly is because of lift the foil has no lift

Explanation:

5 0
3 years ago
Information such as tolerances and scale can be found in the _______________ of an engineering drawing.
nasty-shy [4]

Answer:

Information such as tolerance and scale can be found in the <u>title block</u> of an engineering drawing

Explanation:

The title block of an engineering drawing can normally be found on the lower right and corner of an engineering drawing and it carries the information that are used to specify details that are specific the drawing including, the name of the project, the name of the designer, the name of the client, the sheet number, the drawing tolerance, the scale, the issue date, and other relevant information, required to link the drawing with the actual structure or item

8 0
3 years ago
Other questions:
  • Two kg of N2 at 450 K, 7 bar is contained in a rigid tank connected by a valve to another rigid tank holding 1 kg of O2 at 300 K
    13·1 answer
  • Water at 20oC, with a free-stream velocity of 1.5 m/s, flows over a circular pipe with diameter of 2.0 cm and surface temperatur
    13·1 answer
  • 1- A square-wave inverter has a dc source of 96 V and an output frequency of 60 Hz. The load is a series RL load with R = 5 Ohm
    7·1 answer
  • *6–24. The beam is used to support a dead load of 400 lb&gt;ft, a live load of 2 k&gt;ft, and a concentrated live load of 8 k. D
    13·1 answer
  • A sum of $500,000 will be invested by a firm two years from now. If money is worth 12%, what will be the worth of this investmen
    12·1 answer
  • What is the theoretical density in g/cm3 for Lead [Pb]?
    13·1 answer
  • A block of mass 0.75 kg is suspended from a spring having a stiffness of 150 N/m. The block is displaced downwards from its equi
    5·2 answers
  • Rosbel or Janette lol baakkaaa
    11·2 answers
  • You need to lower your lift onto the mechanical load-holding devices to provide structural support before working under the lift
    12·1 answer
  • A plant has ten machines and currently operates two 8-hr shift per day, 5 days per week, 50 weeks per year. the ten machines pro
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!