Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I just created this method for a 2D array but is throwing me an exception. I want it to do this with a certain number

I just created this method for a 2D array but is throwing me an exception.

I want it to do this with a certain number of rows.

image text in transcribed

This is my method:

private void createTriangle() { //Initializing the array with 1 more than the size of the rows array = new int[rows][];

array[0] = new int[1];//declaring number of elements in row array[1] = new int[2];//declaring number of elements in row

array[0][0] = 1;// Store a 1 in the first column of the first row // Store a 1 in the first column of every from the second one on array[1][0] = 1; // Store a 1 in the last column of every row from the second one on array[1][1] = 1; for (int i = 2; i

for (int i = 2; i 1. Store a 1 in the first column of the first row 2. Store 1's in the first column and second columns of the second row 3. For each additional row, do: - Store 1's in the first and last columns For every other column, store the sum of the values in the previous row previous column and previous row, same column

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_2

Step: 3

blur-text-image_3

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 Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Discuss the techniques of sales forecasting.

Answered: 1 week ago

Question

Write short notes on Marketing mix.

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago