1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Kisachek [45]
3 years ago
13

Write a Java program in jGRASP that creates a 2D integer array of 5 rows and 20 columns, fills it with increasing integer values

ranging from 0 to 59 and then prints the array
Computers and Technology
1 answer:
Alex73 [517]3 years ago
7 0

Answer:

As per the question we need to make 5 rowa and 2o columns, in this we have total element 100 so range should be 0 to 99, but we are suggested to keep range 0 to 59, so i have kept the elementns in the range, but if it was a typo in the question for range you do not need to reset the k with zero.

Explanation:

//create a new class  TestArray

public class TestArray {

//define main method

public static void main(String[] args) {

 //declare a 2D array of given size i.e. 5 rows and 20 columns

 int arr[][] = new int[5][20];

 //declare an integer variable k and initialize it with zero, this will used to initialize the array from 0 to 99

 int k = 0;

 //for loop for rows

 for (int i = 0; i < 5; i++) {

  //for loop for columns

  for (int j = 0; j < 20; j++) {

   //initialize arr with the current value of k

   arr[i][j] = k;

   //once k is 59 set it zero again as we are not going beyond 59

   if(k == 59)

    k = 0;

   //increment value of k with 1

   k++;

  }

 }

 //print the element from the array one by one

 //for loop for rows

 for (int i = 0; i < 5; i++) {

  //for loop for columns

  for (int j = 0; j < 20; j++) {

   //print the current element of array and an space with it

   System.out.print(arr[i][j]+" ");

  }

  // move the cursor to new line

  System.out.println();

 }

}

}

You might be interested in
Este tipo de software sirve para controlar e interactuar con el sistema operativo, proporcionando control sobre el hardware y da
attashe74 [19]

Answer: c

Explanation:

4 0
2 years ago
What is computer hacking? describe some examples
Naily [24]
Computer hacking<span> refers to the practice of modifying or altering </span>computer<span> software and hardware to accomplish a goal that is considered to be outside of the creator's original objective.
</span>
“bot,” is a computer under the control of a hacker <span>without the knowledge of the computer user.</span>

3 0
3 years ago
A computer _________________ is a text file that a computer can understand
Gekata [30.6K]

Answer:

A computer ___Task__ is a text file that a computer can understand

6 0
2 years ago
Which of the following resources is an example of a web-based application?
kompoz [17]
The answer will be google docs since it depends on a web and its an application. hope it helps

3 0
3 years ago
Assume that an int variable counter has already been declared. Assume further a variable counterPointer of type "pointer to int"
Triss [41]

Answer:

Following are the statement:

counterPointer = &counter;

Explanation:

The following statement is correct because in the question it is given that there is an integer data type variable i.e., "counter" and there is another integer data type pointer variable i.e., "counterPointer" and finally we write a statement in which the pointer variable points to the integer variable.

5 0
3 years ago
Other questions:
  • Which of these is a preferred method for
    14·2 answers
  • Match the following.
    8·2 answers
  • Read the following paragraph:
    9·2 answers
  • Which type of text may be formatted to print at the bottom of every page?
    6·1 answer
  • ____ is another term for document properties.
    12·1 answer
  • If the physical memory size is doubled without changing any of its other parameters, the number of entries in the page table
    5·1 answer
  • A user calls to report that she is experiencing intermittent problems while accessing the wireless network form her laptop compu
    9·1 answer
  • Does white space have visual weight? Yes or No
    7·2 answers
  • First person to answer gets free brainlist
    15·2 answers
  • ¿por que hay peligros en internet?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!