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
Please answer this now I need please.
choli [55]

Answer:

You can change the color of text in your Word document. Select the text that you want to change. On the Home tab, in the Font group, choose the arrow next to Font Color, and then select a color.

You can display a graphics window and draw colorful shapes in it if you use the Show operation of the GraphicsWindow object. You can also specify properties of the graphics window, such as its title, height, width, and background color.

Explanation: Sorry I couldn't do the third question but hope it helps.

7 0
3 years ago
What type of attacks take advantage of vulnerabilities in poorly coded web application software to introduce malicious program c
Yakvenalex [24]

Answer:

SQL Injection

Explanation:

Coding a web application that uses a database is requiring close attention, where the developer closes any loophole any attacker may later want to exploit when the application is deployed. SQL Injection is a type of attack where the attacker places malicious code in the query statements through the form. This is possible if the input is not properly sanitized and cleaned.

5 0
3 years ago
In creating a professional action plan it's important to
blagie [28]
Whenever creating a professional action plan, it might be easier to do an "if...then..." plan, or just a daily plan, like this:

Monday:
Kitchen:
 Do dishes
 Sweep floor
 Wipe counters

Bedroom:
 do laundry etc,
5 0
3 years ago
Write only in C, not C++.
yawa3891 [41]

Answer:

#include <iostream>

using namespace std;

int main() {

  int k;

double d;

string s;

cin >> k >> d >> s;

cout << s << " " << d << " " << k << "\n" << k << " " << d << " " << s; }

                                                                   

Explanation:

k is int type variable that stores integer values.

d is double type variable that stores real number.

s is string type variable that stores word.

cin statement is used to take input from user. cin takes an integer, a real number and a word from user. The user first enters an integer value, then a real number and then a small word as input.

cout statement is used to display the output on the screen. cout displays the value of k, d and s which entered by user.

First the values of k, d and s are displayed in reverse order. This means the word is displayed first, then the real number and then the integer separated again by EXACTLY one space from each other. " " used to represent a single space.

Then next line \n is used to produce a new line.

So in the next line values of k, d and s are displayed in original order (the integer , the real, and the word), separated again by EXACTLY one space from each other.

The program along with the output is attached.

7 0
3 years ago
Emily is an aspiring lyricist. She wants to make a demo tape to send to recording companies. Which input device can she use to r
satela [25.4K]
She would use a microphone. A joystick and mouse are two answers we could eliminate immediately. Seeing as she is an aspiring lyricist means she is in the music industry, so she wold need to use a microphone to be able to record.  
6 0
3 years ago
Other questions:
  • RADIAC instruments that operate on the ionization principle are broken down into three main categories based on what?
    15·1 answer
  • Due to the internal style sheets of some browsers, your website may look different to someone who is using firefox as opposed to
    11·1 answer
  • What role do you think mobile devices have played in shaping the world?
    13·1 answer
  • If you delete a file from removable media, it is stored in the recycle bin where you can recover it until you empty the recycle
    13·1 answer
  • Example: An amount of $1,500.00 is deposited in a bank paying an annual interest rate of 4.3%, compounded quarterly. What is the
    5·1 answer
  • Text can be easily moved from one location to another using _____.
    15·1 answer
  • A. What is MS-Word ? Write its uses.
    14·2 answers
  • Compare and contrast two fundamental security design principles in network security. Analyze how these principles and how they i
    15·1 answer
  • Microsoft Access is a
    10·1 answer
  • What is an example of work performed by an integration platform as a service (ipaas)?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!