import java.util.Scanner;

class Oct16 {
	public static void main(String[] args) {

		// store 5 ints read from kb into an array
		Scanner kb = new Scanner(System.in);

		int[] arr1 = new int[5];
		
		System.out.println("Please enter 5 integers separated by spaces");

		for(int i = 0; i < 5; i++) {
			// set element at index i to value read from kb 
			arr1[i] = kb.nextInt(); 
		}
		
		printIntArray(arr1);
	
		// store 5 characters read from kb into an array

		System.out.println("Enter 5 characters separated by spaces");

		char[] arr2 = new char[5];

		for(int i = 0; i < 5; i++) {
			arr2[i] = kb.next().charAt(0); 
		}
		printCharArray(arr2);	

		// clone arr1 
		int[] clone = new int[arr1.length];
		for(int i = 0; i < arr1.length;i++) {
			clone[i] = arr1[i];
		}
		printIntArray(clone);

		// print elements of a 2D array of integers
		int[][] bob = {{1,2,3}, {4,5,6}};

		for(int i = 0; i < bob.length; i++) {
			int[] array = bob[i];
			printIntArray(array);	
		}

		for(int i = 0; i < bob.length; i++) {
			for(int j = 0; j < bob[i].length; j++) {
				System.out.printf("%d ", bob[i][j]);
			} 
			System.out.println();
		}

		// Ask the user to enter length of array
		// then allocate an array of that size

		System.out.println("Enter length of array");
		int length = kb.nextInt();
		int[] arr3 = new int[length];
		printIntArray(arr3);

		// populate arr3 with random numbers between 0 and 100
		for(int i = 0; i < arr3.length; i++) {
			arr3[i] = (int) (Math.random() * 100);
		}
		printIntArray(arr3);

		// Ask user to enter 2 dimensions of game board
		// then allocate board
		System.out.println("Enter dimensions of game board");
		int numRows = kb.nextInt();
		int numCols = kb.nextInt();
	
		char[][] board = new char[numRows][numCols];

		for(int i = 0; i < board.length; i++) {
			for(int j = 0; j < board[i].length; j++) {
				board[i][j] = '0';
				System.out.printf("%c ", board[i][j]);
			}
			System.out.println();
		}	




	}

	static void printIntArray(int[] a) {
		for(int i = 0; i < a.length; i++) {
			System.out.printf("%d ", a[i]);
		}
		System.out.println();
	}

	static void printCharArray(char[] a) {
		for(int i = 0; i < a.length; i++) {
			System.out.printf("%c ", a[i]);
		}
		System.out.println();
	}

}
