Question: Create a class containing a method name createArray and a main method. The method createArray creates an array where each element contains the square of

Create a class containing a method name createArray and a main method. The method createArray creates an array where each element contains the square of its index. The size of the array is determined by the methods parameter. createArray then returns this array. The main methods calls createArray with the right parameter to get the squares of the numbers from 0 to 12, it then prints the values of the array.

The output should be similar to this:

Create a class containing a method name createArray and a main method.

The square of 0 is 0 The square of 1 is 1 The square of 2 is The square of 3 is 9 The square of 4 is 16 The square of 5 is 25 The square of 6 is 36 The square of 7 is 49 The square of 8 is 64 The square of 9 is 81 The square of 10 is: 100 The square of 11 is: 121 The square of 12 is 144

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!