answer.
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
Delvig
24 days 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:
Kisachek [217]24 days 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 to 4 assigned to NUM_VALS

int[] origList = new int[NUM_VALS];

int[] offsetAmount = new int[NUM_VALS];

int i;

//two arrays origList[] and offsetAmount[] get assigned their 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=""; // variable for storing the product results

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

/* iterates from 0 to the end of origList */

/* multiplies each origList entry with the corresponding offsetAmount entry, stores results in product */

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

System.out.println(product); }}

Output:

80 180 80 400

Explanation:

If you wish to print the product of origList alongside offsetAmount values vertically, this can be done in this manner:

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 is shown with the output as a screenshot along with the example's input.

You might be interested in
A subway car leaves station A; it gains speed at the rate of 4 ft/s^2 for of until it has reached and then at the rate 6 then th
Daniel [215]

Answer:

Refer to the attached document

1512 ft

Explanation:

Because the acceleration is constant or zero, the acceleration-time graph consists of horizontal segments. The values for t2 and a4 are derived as follows:

Acceleration - Time

0 < t < 6: Velocity change = area beneath the a–t graph

V_6 - 0 =  (6 s)(4 ft/s²) = 24 ft/s

6 < t < t2: The velocity rises from 24 to 48 ft/s,

Velocity change = area beneath the a–t graph

48 - 24 = (t2 - 6) * 6

t2 = 10 s

t2 < t < 34: The velocity remains constant, meaning acceleration is zero.

34 < t < 40: Velocity change = area beneath the a–t graph

0 - 42 = 6*a4

a4 = - 8 ft / s²

A negative acceleration shows the area lies below the t-axis, indicating a decrease in speed.

Velocity - Time

Since acceleration remains constant or zero, the v−t graph is made up of linear segments connecting the calculated points.

Position change = area beneath the v−t graph

0 < t < 6:  x6 - 0 = 0.5*6*24 = 72 ft

6 < t < 10:    x10 - x6 = 0.5*4*(24 + 48) = 144 ft

10 < t < 34: x34 - x10 = 48*24 = 1152 ft

34 < t < 40: x40 - x34 = 0.5*6*48 = 144 ft

Summing these position changes yields the distance from A to B:

d = x40 - 0 = 1512 ft

8 0
17 days ago
Compute the sum with carry-wraparound (sometimes called the one's complement sum) of the following two numbers. Give answer in 8
grin007 [219]

Response:

00100111

Explanation:

We have been given;

10010110

10010000

Add them following standard binary addition rules

10010110

10010000

-------------

(1)00100110

-------------

ignore the leading (1) because it is a carry.

Increase the result by 1 to achieve a 1's complement sum

00100110 + 1 = 00100111

Final Result: 00100111

3 0
21 day ago
An insulated box containing helium gas falls from a balloon 4.5 km above the earth's surface. calculate the temperature rise in
iogann1982 [279]
The increase in temperature of the helium gas is calculated to be 14.25 K. The helium is located in an insulated box that falls from a height of 4.5 km. As it descends, the potential energy is transformed into internal energy of the helium gas. The equation for temperature change can be expressed as: 10 x 4.5 = 3.15 x ΔT, yielding a temperature increase of ΔT = 14.25 K.
6 0
2 days ago
A 90-hp (shaft output) electric car is powered by an electric motor mounted in the engine compartment. If the motor has an avera
pantera1 [220]

Answer:

Heat supply rate is measured at 8.901 horsepower.

Explanation:

Energy efficiency of the electric vehicle, as per Thermodynamics (\eta), is the proportion of translational mechanical power (\dot E_{out}), expressed in horsepower, and electrical energy (\dot E_{in}), also in horsepower. The heat supply rate (\dot E_{l}), indicated in horsepower, that the motor delivers to the engine bay under full load can be determined by subtracting the translational mechanical energy from the electric energy. This is expressed as:

\eta = \frac{\dot E_{out}}{\dot E_{in}} (1)

\dot E_{l} = \dot E_{in}-\dot E_{out} (2)

\dot E_{l} = \left(\frac{1}{\eta}-1\right)\cdot \dot E_{out} (3)

If we have the values of \eta = 0.91 and \dot E_{out} = 90\,hp, the heat supply rate can be calculated as:

\dot E_{l} = \left(\frac{1}{0.91}-1 \right)\cdot (90\,hp)

\dot E_{l} = 8.901\,hp

The heat supply rate amounts to 8.901 horsepower.

4 0
25 days ago
The critical resolved shear stress for iron is 27 MPa (4000 psi). Determine the maximum possible yield strength for a single cry
grin007 [219]

Answer:

The following represents the answer.

Explanation:

Calculation for the maximum yield strength of a single crystal of Fe subjected to tension can be found in the attached image.

The maximum yield strength value is 54 MPa.

7 0
1 month ago
Other questions:
  • 1. You do not need to remove the lead weights inside tires before recycling them.
    8·1 answer
  • A fireboat is to fight fires at coastal areas by drawing seawater with a density of 1030 kg/m through a 20-cm-diameter pipe at a
    13·1 answer
  • The in situ moist unit weight of a soil is 17.3 kN/m3 and the moisture content is 16%. The specific gravity of soil solids is 2.
    12·1 answer
  • All MOS devices are subject to damage from:________
    7·1 answer
  • An AM radio transmitter operating at 3.9 MHz is modulated by frequencies up to 4 kHz. What are the maximum upper and lower side
    12·1 answer
  • An air duct heater consists of an aligned array of electrical heating elements in which the longitudinal and transverse pitches
    5·1 answer
  • Radioactive wastes are temporarily stored in a spherical container, the center of which is buried a distance of 10 m below the e
    13·1 answer
  • Consider a very long, slender rod. One end of the rod is attached to a base surface maintained at Tb, while the surface of the r
    8·1 answer
  • You want to determine whether the race of the defendant has an impact on jury verdicts. You assign participants to watch a trial
    9·1 answer
  • A well-insulated rigid tank contains 1.5 kg of a saturated liquid–vapor mixture of water at 200 kPa. Initially, three-quarters o
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!