Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Program???

  1. #1
    Junior Member
    Join Date
    Dec 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Program???

    Example Array foo[][] data

    Col 0
    Col 1
    Col 2
    Col 3
    Col 4
    Col 5


    Row 0
    876
    8
    69876
    1234
    2354
    3


    Row 1
    97
    64
    875
    5
    456
    467


    Row 2
    75
    765
    89
    1231344
    456
    23


    Row 3
    76
    57
    96
    66
    67
    23

    Last row
    123
    3887
    78783
    773
    1
    2



    Complete the method code below so that the method will sum up the values of the even-numbered columns (including 0) of the array parameter foo as shaded in the table above.

    The number of rows and columns are unknown and can be inferred from from the array itself. The last column may or may not be an even-numbered column. Make sure to account for this in your method.

    Return the sum of those cells from the method.

    You may only use two loops inside the method.

    You do not need to write a complete program, but make sure that your method is complete and would compile if used inside a complete program.

    Starter Code (copy and paste into answer box, use Courier New font, and then fill in relevant code)

    /*
    * method Name : sumArray
    * Parameters : int array foo
    * Task : sum even columns in matrix
    * Return : the summation of all even columns
    */

    public static int sumArray ( int foo [][] )
    {


    }
    Last edited by DestinyChick1225; April 23rd, 2010 at 04:46 PM.


  2. #2
    Junior Member
    Join Date
    Mar 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Program???

    Complete it on your own and if there will be some problems in your code, we will help you.
    Better try yourself and don't depends upon others for the whole thing. Just try once and put your effort here. Thanks