Courses‎ > ‎AP Computer Science‎ > ‎Konstantinovich‎ > ‎

2018-11-02

posted Nov 2, 2018, 6:12 AM by Konstantinovich Samuel   [ updated Nov 5, 2018, 6:38 PM ]
Today: Lab Day

Quiz Wed.
Theory + Coding.
Including up to ArrayLists.

Lab Due Monday:
Ordered Super Array

HW Due Wed: (I don't want to make 2things due the same day, so I will give extra time for this:

There are 6 methods, but they have a lot of overlap.
Repo: MKS21X-2darraymethods


Part 1-2
I will not try to go out of bounds explicitly by my making the index too large or too small. 
Part 3:
I will test that non-rectangular arrays (ragged arrays) work properly.

public class ArrayMethods{

   /*
   *PART 1
   */
   public static int rowSum(int[][] ary, int x){}
    //returns the sum of the elements in Row x of ary
    //When x is past the last row count it as a zero. (NO indexOutOfBounds should ever occur)

   public static int columnSum(int[][] ary, int x){}
    //returns the sum of the elements in Column x of ary (careful with rows of different lengths!).
    //When a row is not long enough to reach the column count it as a zero. (NO indexOutOfBounds should ever occur)
    
   /*
   *PART 2 - use prior methods where appropriate
   */
   public static int[] allRowSums(int[][] ary){}
    //returns an array of the row sums for each row of ary. 
    //Index i of the return array contains the sum of elements in row i.

    public static int[] allColSums(int[][] ary){}
    //Returns an array with the column sum of each column of ary.
    //When a row is not long enough to reach the column count it as a zero. (NO indexOutOfBounds should ever occur)
    //Index i of the return array contains the sum of elements in column i, ignoring any rows that are too short.
    //The length of the returned array should be the length of the LONGEST array in ary.

  
   /*
   *PART 3 - use prior methods where appropriate
   */
   public static boolean isRowMagic(int[][] ary){}
     //checks if the array is row-magic (this means that every row has the same row sum).

   public static boolean isColumnMagic(int[][] ary){}
    //checks if the array is column-magic (this means that every column has the same column sum).

}


Comments