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]
4 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]4 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
Originally, Java was used to create similar apps as what other language?
klio [65]
The answer would be python. the first was javascript and they changed to python.
4 0
3 years ago
Why is it important to place the sheave wheel in exactly the right place on the head frame?
lord [1]

I guess because these cables are hooked up to a elevate that transport miners, machines and ore into and out of the mine.

7 0
3 years ago
The East Coast sales division of a company generates 62 percent of total sales. Based on that percentage, write a Python program
Gennadij [26K]

Answer:

def prediction(sales):

print(0.62 * sales)

prediction(4600000)

Explanation:

Code written in python :

We could write it out has a function :

The code is written has a function ;

'def' starts the function which is named prediction. The function takes in a single argument which is the amount of sales made. Since the percentage of sales generated is a constant pegged at 62%. The expression print( 0.62 * sales) outputs the amount generated by east coast. The function call; prediction(4600000) prints the amount generated if a sales of $4600000 is made.

8 0
3 years ago
Which form of topology has the fastest performance?<br><br> Star<br><br> Ring<br><br> Hybrid
aivan3 [116]
The answer is ring.
Hope this helped!
3 0
3 years ago
What is the full form of flops​
kobusy [5.1K]

Answer:

<em>Floating Point Operations Per Second</em> (FLOPS)

Explanation:

<em>Floating Point Operations Per Second</em> (FLOPS) is a measure of a computer’s performance, especially in fields of scientific calculations that make heavy use of floating-point calculations. Floating-point operations include any operations that involve fractional numbers.

8 0
3 years ago
Read 2 more answers
Other questions:
  • What command would you use to make a secure shell connection to the ubuntu client machine? ()?
    9·1 answer
  • Which process improves the life of a computer?
    11·1 answer
  • Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006. Given a variable modelYear write a state
    11·1 answer
  • Select the correct answer.
    13·1 answer
  • Suppose you have the following declaration.char[] nameList = new char[100];Which of the following range is valid for the index o
    7·1 answer
  • What Fortnite skin is more og?
    5·2 answers
  • Which of the following jobs usually requires some level of formal higher education other than vocational training?
    14·2 answers
  • Please help me
    7·2 answers
  • What are the difference between bit address 7ch and byte address 7ch
    11·1 answer
  • Ohh I'm so cool It a doge clicker!! What is a doge?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!