// Arup Guha
// 4/24/2016
// Framework for 2015 AP CS A Free Response Question 1: Two Dimensional Array Diversity

import java.util.*;

public class Array2D {

	public static void main(String[] args) {

		Random r = new Random();

		// Test our method five times.
		for (int test =0; test<5; test++) {

			// Generate and print a 2d array.
			int[][] nums = getRandomArray(4, 5, r, 10+test*5);
			System.out.println("Here is the array generated:");
			print2D(nums);

			// Test row sums.
			int[] rows = rowSums(nums);
			System.out.println("Here are the row sums:");
			print1D(rows);

			// Test isDiverse method.
			System.out.println("Results of diversity: "+isDiverse(nums)+" "+isDiverseV2(nums)+" "+isDiverseV3(nums));
		}
	}

	/*** Fill in your solution to part A here. ***/
	public static int arraySum(int[] arr) {

	}

	/*** Fill in your solution to part B here. ***/
	public static int[] rowSums(int[][] arr2D) {

	}

	/*** Fill in your solution to part C here. ***/
	public static boolean isDiverse(int[][] arr2D) {

	}

	// So we can see what's in our array.
	public static void print2D(int[][] arr2D) {
		for (int i=0; i<arr2D.length; i++)
			print1D(arr2D[i]);
	}

	// Prints out a 1D array.
	public static void print1D(int[] arr) {
		for (int i=0; i<arr.length; i++)
			System.out.printf("%5d", arr[i]);
		System.out.println();
	}

	// Returns a random array of size numRows x numCols with all elements in the range [1, max].
	public static int[][] getRandomArray(int numRows, int numCols, Random r, int max) {
		int[][] res = new int[numRows][numCols];
		for (int i=0; i<res.length; i++)
			for (int j=0; j<res[i].length; j++)
				res[i][j] = r.nextInt(max) + 1;
		return res;
	}
}