Tuesday, October 11, 2011

CHALLENGE:Java Tut 32-34-Arrays in Methods & Multidimensional Arrays

The following is a challenge for new developers that have completed:
 Java Tutorial's 32-34 by theNewBoston. To get the most out of these challenges try them a few hours or the day after watching/following along with the actual video.
 


B.A.M.F Challenge:
B.A.M.F Challenges & why you want to always at leas try them explained Here:http://bit.ly/ogivqe
Difficulty: 1/2
 Create a java console program with a method that accepts a multidimensional array in its parameters.When the method is called it should print the array out to the console as a table.If you've done everything right you're results should look like this:


This is the the Multi Array
8        9        5          12
55      12        32         22
15       4        39         83




CHALLENGE!!
(Before starting any of the challenges always declare a class and a main method unless told otherwise)
 Difficulty:★2/3
1.Create a multidimensional array. It should have at least 3 arrays inside of it and each array should have several values.

2.Create a method that accepts a multidimensional array in its parameters, name the array in the parameters "x" and name the method "display"[

3.Inside the display method create a for loop, name you're counter "row; loop  through until x.length is less than "row" ; increment by 1

Inside of the "row" for loop insert: [

  • Another for loop. name you're counter "column"; loop  through until x.length is less than "x[row].length;increment by 1. Inside the "column" for loop insert:


  •    1.A print line statement that prints  x[row][column] + "\t"]

  • Print line statement that prints: a blank line] ]


    • 4.In the main method write a print line statement that reads "This is the array table"

      5.In the main method call the display method and place you're array in the parameters

      Note: I am trying to experiment to find the best way to explain loops in words. Everything that is Orange is inside of the "Row" for loop and everything that is red is inside the "column" for loop. If this made it easier for you to understand or you have some suggestions to improve these challenges leave it in a comment below!!


      COMPILE & PRAY TO DUKE!!!
      View the video tutorial: http://bit.ly/r9jFZN
       
      ;