Question: In this program, we are going to create a 2 dimensional array and print its contents as a table. We will create a multiplication table

In this program, we are going to create a 2 dimensional array and print its contents as a table. We will create a multiplication table similar to what we did with nested loops in the previous lab. (Nested Loops listed in bold at the bottom)

a. Create a class named TwoDArrayTester

b. Create a two dimensional array with 9 columns and 10 rows.

c. Create nested loops. Inside the loops multiply the column by the row. The only issue is the the index is 1 less than the desired number so you must add 1 to it. You code should look something like: twoDArray[i][j] = (i+1) * (j+1);

d. Create another nested loop to print the table. Remembering what you did in the previous lab to get the table to print correctly (adding spaces for values <10), print the table.

public class NestedLoops { public static void main(String args[]) { for(int i=1;i<=10;i++) { for(int j=1;j<10;j++) { System.out.print("\t"+i*j); } System.out.println(); } } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!