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
An 80-L vessel contains 4 kg of refrigerant-134a at a pressure of 160kPa. Determine (a) the temperature, (b) the quality, (c) th
makvit [3.9K]

Answer:

temperature -15.6 C, quality x=0.646, enthalpy h=667.20 KJ, volume of vapor phase Vg= 79.8 L

Explanation:

property table for R-134a

https://www.ohio.edu/mechanical/thermo/property_tables/R134a/R134a_PresSat.html

at 160 KPa , temperature = -15.66 C

quality x=mass of vapour/ total mass of liq-vap mixture

alternaternately: x=(v-vf)/(vg-vf)    

v=total volume i.e. volume of container"80L"   80L=0.08 cubic meter

vf=vol of liquid phase  vg=vol of vapor phase vf, vg values at 160Kpa

x=(0.08-0.0007437)/(0.1235-0.0007437)=0.646

enthalpy

h=hf+xhfg          hf, hfg values at 160Kpa

h=hf+xhfg=31.2+0.646(209.9)=166.80 KJ/Kg

for 4Kg R-134a h=m(166.80 KJ/Kg )=667.20 KJ

volume of vapor phase

vg at 160Kpa=0.1235 cubic meter for quality=1.

in this case quality=0.646 , so it will occupy 64.6% space of the vapor phase at quality=1.

vol. of vapor phase=0.646*0.1235=0.0798 cubic meter=79.8 L

7 0
3 years ago
When was solar power envold ​
Lyrx [107]

Answer:

1839

Explanation:

the first huge step in solar penal technology came when alxendare becquerel observed the photovolatic effect in 1839,which occurs when a material produces electric current when exposed to light.it was not untill 1888 that the first solar cell was actually built by aleksander stoletov.

5 0
3 years ago
Read 2 more answers
What is the purpose of having a ventilation system on board a motorized vessel?.
chubhunter [2.5K]

The purpose of having a ventilation system on board a motorized vessel is : To remove flammable gas from a vessel to avoid explosions.

<h3>Meaning of ventilation system</h3>

A ventilation system can be defined as a system that allows for removal of gases from a vessel to the atmosphere.

A Ventilation system is very important in every motorized vessel because they help to eliminate or remove flammable gases that are dangerous and are liable to explode when held in a large amount in the engine.

In conclusion, The purpose of having a ventilation system on board a motorized vessel is to remove flammable gas from a vessel their by avoiding explosions.

Learn more about Ventilation System: brainly.com/question/1687520

#SPJ4

4 0
2 years ago
An aluminium alloy tube has a length of 750 mm at a temperature of 223°C. What will be its length at 23°C if its coefficient of
uranmaximum [27]

Answer:

Final length= 746.175 mm

Explanation:

Given that Length of aluminium at 223 C is 750 mm.As we know that when temperature of material increases or decreases then dimensions of material also increases or decreases respectively with temperature.

Here temperature of aluminium decreases so the final length of aluminium decreases .

As we know that

\Delta L=L\alpha\Delta T

Now by putting the values

\Delta L=750\times \25.5\times 10^{-6}\times 200

ΔL=3.82 mm

So final length =750-3.82 mm

Final length= 746.175 mm

3 0
3 years ago
Which of the following is NOT an ASE certification? Select one:
stiks02 [169]

The option that is not an ASE certification is . A/C and Refrigerants handling certification (609).

<h3>What is ASE certification?</h3>

The term ASE is known to be a body that tends to promotes excellence in regards to vehicle repair, service as well as parts distribution.

Note that in the world today more than a quarter of  million of people are known to possess ASE certifications.

Since ASE Certified professionals work in in all areas of the transportation industry. one can say that The option that is not an ASE certification is. A/C and Refrigerants handling certification (609).

Learn more about ASE certification from

brainly.com/question/5533417

#SPJ1

8 0
2 years ago
Other questions:
  • What is a construction worker with limited skills called?
    12·1 answer
  • 6. PVC boxes are primarily used in new construction because it is simple to
    11·1 answer
  • 4. What are the basic scientific principles the engineers who designed the digital scales would have needed to understand to des
    5·1 answer
  • 1. Using a typical frequency value for the initiating event and PFD values provided in class lectures, estimate the mishap or co
    6·1 answer
  • Air at 27°C, 1 atm flows parallel to a flat plate, which is electronically heated. The plate is 0.5 m long in the direction of f
    8·1 answer
  • How does refrigeration preserve food and dead bodies​
    12·2 answers
  • Calculate the number of vacancies per cubic meter for some metal, M, at 749°C. The energy for vacancy formation is 0.86 eV/atom,
    5·1 answer
  • What is the difference between a natural and artificial diamond ​
    6·2 answers
  • Is A fine by the EPA may be imposed on the employer or
    8·1 answer
  • If a condenser has high head pressure and a higher than normal temperature, a technician could ____.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!