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
Fix thos code:Error using spm_check_installation&gt;check_basic (line 93) You do not appear to have the function search path set
grandymaker [24]

Answer:

<em>addpath C:\Program Files\MATLAB\ToolBoxes-20181106T221851Z-001\ToolBoxes\SPM\spm12</em>

<em>savepath</em>

Explanation:

The error clearly indicates that the SPM is missing and is not properly installed. In order to correct this, the following commands are required to be run in the command line of the MATLAB.

These commands will do following.

The first command is the addpath, this will add the path of the toolboxes in the working directory path of the MATLAB

<em>addpath C:\Program Files\MATLAB\ToolBoxes-20181106T221851Z-001\ToolBoxes\SPM\spm12</em>

The second command is the savepath, this will save the additional added path of the working directory for future use.

<em>savepath</em>

5 0
3 years ago
Write a method called min that takes three integers as parameters and returns the smallest of the three values, such that a call
Debora [2.8K]

Answer:

public class Main

{

public static void main(String[] args) {

 System.out.println(min(3, -2, 7));

}

public static int min(int n1, int n2, int n3){

    int smallest = Math.min(Math.min(n1, n2), n3);

    return smallest;

}

}

Explanation:

*The code is in Java.

Create a method named min that takes three parameters, n1, n2, and n3

Inside the method:

Call the method Math.min() to find the smallest among n1 and n2. Then, pass the result of this method to Math.min() again with n3 to find the min among three of them and return it. Note that Math.min() returns the smallest number among two parameters.

In the main:

Call the method with parameters given in the example and print the result

7 0
2 years ago
What is the simplest way to permanantly get rid of an unwanted file
UNO [17]
If on a computer, if thee computer says they put it in the recycling bin, the go to the recycling bin and right click and delete. If a paper, throw away. If other, do what your body desires to do.<span />
4 0
3 years ago
Another one please help quick i got to go soon
astraxan [27]

Answer:

no

Explanation:

yellow: the last sentence in the text

blue: Queenies flowers reached for the sky

Personification means that you apply human characteristics to things that are not alive, like a flower smiling, a term used when people see a field of healthy flowers

7 0
2 years ago
What are the three major functions of a game engine?
Harrizon [31]
read that hope this helped

8 0
3 years ago
Other questions:
  • The technology (software) that automatically downloads website information to your computer is called ________.'
    15·1 answer
  • To easily add an organizational chart to a document, users should select _____. SmartArt Text Boxes Shapes Clip Art
    8·2 answers
  • Brute force attacks involve identifying a valid user account and then bombarding the server with an extensive:
    13·1 answer
  • Your car must have two red stoplights, seen from ______ feet in the daytime, that must come on when the foot brake is pressed.
    6·1 answer
  • Write a program that asks the user to enter the amount s/he has budgeted for a month. The amount should be between 1000 and 2000
    11·1 answer
  • Write a program that gets a single character from the user. If the character is not a capital letter (between 'A' and 'Z'), then
    15·1 answer
  • Npesta kenos reaction
    13·2 answers
  • When planning your App what difficulties did come across and why?
    5·2 answers
  • . A binary search has a right subtree but no left subtree. What noes contains that least element in the tree
    11·1 answer
  • **HELP ME PLS**
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!