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
Ivanshal [37]
3 years ago
13

Write a program, TwoDimentionalGrid. Ask the user to enter the size of the 2 dimensional array. Here we are not doing any input

validation. We are assuming, user is going to enter a number greater than 1. Create a 2D array with the same row and column number. Now print the array as a number grid starting at 1. Example: At place row number 3 and column number 2, number would be 6 (3*2). Any number would be the product of it's row number and column number. Hint: Use setw 5. Expected Output: Here I am attaching 2 expected output. Make sure your code is running for both input.
Computers and Technology
1 answer:
Nitella [24]3 years ago
4 0

Answer:

The program in Java is as follows:

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 System.out.print("Array size: ");

 int n = input.nextInt();

 int[][] myarray = new int[n][n];

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

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

         myarray[i][j] = i * j;      }  }

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

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

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

     System.out.println();  }

}}

Explanation:

This prompts the user for the array size

 System.out.print("Array size: ");

This gets input for the array size

 int n = input.nextInt();

This declares the array

 int[][] myarray = new int[n][n];

This iterates through the rows

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

This iterates through the columns

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

This populates the array by multiplying the row and column

         myarray[i][j] = i * j;      }  }

This iterates through the rows

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

This iterates through the columns

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

This prints each array element

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

This prints a new line at the end of each row

     System.out.println();  }

}

You might be interested in
Two routers, R1 and R2, connect using an Ethernet over MPLS service The service provides point-to-point service between these tw
liberstina [14]

Answer: b) R1 will connect to a physical Ethernet link, with the other end of the cable connected to a device at the WAN service provider point of presence.

.d) R1 will forward data link frames to R2 using an Ethernet header/trailer.

Explanation:

Here we have to understand what is MLPS. MLPS is a protocol which identifies the shortest route for the transfer of messages between routers instead of the longest route.

Here we are given a WAN which is a wide area network. Using layer 2 Ethernet service the frames are transmitted across the routers within the WAN.

Option A is incorrect as as connecting the other end of the cable to the R2 would reduce the functionality of the WAN.  Option C is incorrect as HDLC header trailer has no effect.

Option B and D are correct as Ethernet header/ trailer has the same size every frame and to maintain the functionality of the WAN one end must be connected to point of presence(PoP).  

5 0
3 years ago
Which of the following statements is true of alert files?
ozzi

Answer:

They are only generated by Wireshark.

3 0
3 years ago
What was the strategy the company adopted for ERP implementation?
SashulF [63]

Answer:

Big Bang or Phased Approach – ERP Implementation strategies include Big Bang, Phased, Hybrid, and Parallel Adoption. Each organization requirements are different and as such, the project management method is itself evolving using PPM, SCRUM, and DevOps.

8 0
2 years ago
What enforces the location in which an app can function by tracking the location of the mobile device?
Igoryamba

The correct answer is geo fencing.

<h3>what is geo fencing?</h3>

A geofence is a fictitious geographic boundary that can be entered or exited by a mobile device or RFID tag. Geofencing is a location-based service in which an app or other software programme uses radio frequency identification (RFID), Wi-Fi, GPS, or cellular data to trigger a targeted marketing action (such as a text, email, social media advertisement, or app notification).

There are three ways to use this technology to target customers: geotargeting, geofencing, and beaconing. You can track a consumer's location using GPS, Bluetooth, and beacons.

learn more about geo fencing refer:

brainly.com/question/20317002

#SPJ4

4 0
1 year ago
Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards
ozzi

Answer:

The missing part of the code is:

for (i = 0; i < courseGrades.length; ++i) {

           System.out.print(courseGrades[i]+" ");         }

       System.out.println();

       for (i = courseGrades.length-1; i >=0 ; --i) {

           System.out.print(courseGrades[i]+" ");         }

       System.out.println();

Explanation:

This iterates through the array

for (i = 0; i < courseGrades.length; ++i) {

This prints each element of the array followed by a space

           System.out.print(courseGrades[i]+" ");         }

This prints a newline at the end of the loop

       System.out.println();

This iterates through the array in reverse

       for (i = courseGrades.length-1; i >=0 ; --i) {

This prints each element of the array (reversed) followed by a space

           System.out.print(courseGrades[i]+" ");         }

This prints a newline at the end of the loop

       System.out.println();

6 0
3 years ago
Other questions:
  • In Linux Operating System, what file extension is used forexecutable files?
    6·1 answer
  • What happens if you move unencrypted files into an encrypted folder?
    5·1 answer
  • What is the best anime that you like the most (give me 3 plz)
    7·2 answers
  • A(n) _____ is a telephone facility that manages incoming calls, handling them based on the number called and an associated datab
    5·1 answer
  • Circular errors are caused by adding the cell name of a/an _______ cell to a formula.
    6·2 answers
  • Identify when programmers use an Else statement.
    15·2 answers
  • Type of Factor Beginning Frog Count Simulation 1 (Low) Simulation 2 (High)
    13·1 answer
  • 1. A cell is identified by its ........
    8·1 answer
  • What is the answer in music class
    6·1 answer
  • Which type of service offers a preconfigured testing environment for application developers to create new software applications
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!