Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I add two 1D arrays into a 2D array In the code below you can see I'm adding one of the array into

How do I add two 1D arrays into a 2D array

In the code below you can see I'm adding one of the array into the 2D array but I want to add both of them

int numOfSpeed = 5;

int numOfAngels = 8;

int [] speedsArray = {10, 20, 30, 40, 50 };

int [] angelsArray = {10, 20, 30, 40, 50, 60, 70, 80 };

int [][] speedAngels = new int [numOfSpeed][numOfAngels];

int results = 0;

for(int row = 0; row < numOfSpeed; row++ ){

for(int col =0; col < numOfAngels; col++ ){

speedAngels[row][col]= speedsArray[results];

results++;

System.out.println(speedAngels[row][col] + " ");

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

Define Management or What is Management?

Answered: 1 week ago

Question

What do you understand by MBO?

Answered: 1 week ago

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago