Question

In: Computer Science

1.Declare a two-dimensional array of Strings namedchessboard.

1. Declare a two-dimensional array of Strings named chessboard.

2. Declare a two-dimensional array of integers named tictactoe.

3. Declare and create a two-dimensional array of chars,tictactoe, with 3 rows, each with 3 elements.

4. Create a two-dimensional array of ints, plan, with 2 rows, and and 3 columns and initialize the first row to 8, 20, 50 and the second row to 12, 30, 75. Use member initializer syntax.

Solutions

Expert Solution

1.

String[][] chessboard;

2.

int[][] tictactoe;

3.

char[][] tictactoe = {

    {' ',' ',' '},

    {' ',' ',' '},

    {' ',' ',' '},

};

4.

int[][] plan = {

    {8,20,50},

    {12,30,75},

};


Related Solutions

Provide code samples for the following in C#a. Declare a two-dimensional array of integers names...
Provide code samples for the following in C#a. Declare a two-dimensional array of integers names intArray17.b. Create a loop to calculate the sum of every element in the first column.c. Create a loop to calculate the sum of every element in the array.
In C# - Provide code samples for the following: Declare a two-dimensional array of integers names...
In C# - Provide code samples for the following: Declare a two-dimensional array of integers names intArray17. Create a loop to calculate the sum of every element in the first column. Create a loop to calculate the sum of every element in the array.
C++ ASSIGNMENT: Two-dimensional array Problem Write a program that create a two-dimensional array initialized with test...
C++ ASSIGNMENT: Two-dimensional array Problem Write a program that create a two-dimensional array initialized with test data. The program should have the following functions: getTotal - This function should accept two-dimensional array as its argument and return the total of all the values in the array. getAverage - This function should accept a two-dimensional array as its argument and return the average of values in the array. getRowTotal - This function should accept a two-dimensional array as its first argument...
Rewrite your program for part 1. Do not declare the array globally, declare it in the...
Rewrite your program for part 1. Do not declare the array globally, declare it in the loop function. This now requires that you add two parameters to your fill array and print array functions. You must now pass the array name and array size as arguments, when the program calls these functions. The program has the same behavior as problem 1, but illustrates the difference between globally and locally declared variables. The program code for part 1 was: int Array[15]...
Create a two-dimensional array A using random integers from 1 to 10. Create a two-dimensional array B using random integers from -10 to 0.
This program is for C.Create a two-dimensional array A using random integers from 1 to 10. Create a two-dimensional array B using random integers from -10 to 0. Combine the elements of A + B to create two- dimensional array C = A + B. Display array A, B and C to the screen for comparison. (Note a[0] + b[0] = c[0], a[1] + b[1] = c[1], etc.)
How to create a two-dimensional array, initializing elements in the array and access an element in...
How to create a two-dimensional array, initializing elements in the array and access an element in the array using PHP, C# and Python? Provide code examples for each of these programming languages. [10pt] PHP C# Python Create a two-dimensional array Initializing elements in the array Access an element in the array
Write a Java program that will use a two-dimensional array to solve the following tasks: 1....
Write a Java program that will use a two-dimensional array to solve the following tasks: 1. Create a method to generate a 2-dimensional array (random numbers, range 0 - 500). The array has ROW rows and COL columns, where ROW and COL are class constants. 2. Create a method to print the array. 3. Create a method to find the largest element in the array 4. Create a method to find the smallest element in the array 5. Create a...
C++ please 1. Randomly assign integers in the range of 1-100 to a two-dimensional array. Write...
C++ please 1. Randomly assign integers in the range of 1-100 to a two-dimensional array. Write a program that finds the average value of the rows and the average value of the columns. Display the averages. 2. Create an array of randomly generated numbers in any range. Write a function that takes the array as an argument and returns an array that consists of only the even numbers in the original array. Use the function in a program. 3. Create...
1.Write the java code to create a two dimensional String array of sizes 12 by 8;...
1.Write the java code to create a two dimensional String array of sizes 12 by 8; Given the java array:       double[] test = new double[3]; 2.  Write the java code to put the numbers 1.0, 2.0, and 3.0 in to the array so that the 1.0 goes in the first cell, the 2.0 goes in the second cell and the 3.0 goes in the third cell. 3. Can you have different types of data is a three dimensional array? 4....
You will put a possible magic square into a two dimensional array and determine if it...
You will put a possible magic square into a two dimensional array and determine if it is a magic square or not. Some of the code is completed. You can assume that it is a square array and that all of the integers are unique (no repeats) CODE: package TwoDimensionalArrays; public class MagicSquare {    public static boolean checkMagicSquare(int[][]array)    {   //Pre: Assume that the array is a square two dimensional array        //Pre: Assume that there are no...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT