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
il63 [147K]
3 years ago
10

- Create a Java program in both Windows and Ubuntu using any of their Editors *** DO NOT USE IDE'S SUCH AS ECLIPSE, NETBEANS, ET

C *** - Windows : In the Command Line (cmd), use the notepad or notepad++ editor - Ubuntu : In the Terminal Mode use the gedit, or nano or pico or vi or vim editor - Compile and run this program using the MSDOS/Terminal ex: to compile : javac ArrayMath.java to run : java ArrayMath Purpose of this program: - Create a 10 x 10 two dimensional array of int data type (Remember that arrays start with 0, not 1. - Load each index in the array with the multiplication of each (row * column) location - Using printf display the content of each index, ALIGNED. - Create an algorithm using a loop that will add all the values in all odd columns, and print their total aligned below the column. - Print the addition of all values in each index in the array. This is a sum of all the elements of the array. - Print your name and Panther ID below all other output.

Computers and Technology
1 answer:
Marat540 [252]3 years ago
8 0

Answer:

Following are the code to this question:

public class ArrayMath//defining a class ArrayMath

{

public static void main(String[] args) //defining main method

{

int x[][]=new int[10][10]; //defining a 2D array  

arrays(x);//calling a method arrays by passing an array

}

private static void arrays(int[][] x)//defining a method arrays

{

int odd_column_sum=0,sum_of_Elements=0,i,j,even=1;//defining integer variable  

for(i=0;i<x.length;i++)//defining loop for columns  

{

for(j=0;j<x[0].length;j++)//defining loop for rows

{

x[i][j]=i*j;//multiply the i and j value atore in array

}

}

System.out.println("::The 2D array :: ");//print message

for(i=0;i<x.length;i++)//defining loop for columns

{

System.out.print("\t");//use print method for line space and line break  

for(j=0;j<x[0].length;j++)//defining loop for rows

{

System.out.printf("%d\t",x[i][j]); //print array values

}

System.out.println( );//print for line break

}

for(i=0;i<x.length;i++) //defining loop for Columns

{

for(j=0;j<x[0].length;j++) //defining loop for rows

{

if(even%2!=0)//defining if block for check odd number condition

{

odd_column_sum+=x[j][i];//add odd number of array

}

sum_of_Elements+=x[i][j];//add even number of array

}

even++;//increment even variable value by 1

}

System.out.println("The sum of Odd Columns:"+odd_column_sum);//print odd_column_sum value

System.out.println("The array elements :"+sum_of_Elements);//print sum_of_Elements value

}

}

Output:

please find attached file.

Explanation:

In the above-given code, a class "ArrayMath" is defined, inside the class the main method is declared, which define a 2D array "x", this stores 10 columns and 10 rows and at the last, we call the arrays method by passing an array as a variable.

In the arrays method, integer variable, "odd_column_sum, sum_of_Elements, i, j, and even" is defined, in which variable "i and j" is used in the loop for calculating value, even is used to check odd column and then store its value in the "odd_column_sum" variable, and add whole element value is added into the "sum_of_Elements" variable.

You might be interested in
How did you generate a random number for the user to guess?
Verizon [17]

Answer:

B

Explanation:

The build in random function will work the best for your case. Have a marvelous day. :)

5 0
3 years ago
What is the most commonly used tab in the Filter dialog box?
aleksandrvk [35]

The answer is Messages

3 0
3 years ago
Read 2 more answers
25 points select 3 options!!!!!!!!!!!!!!!!!!!!!!!!!
Veronika [31]

Answer: don't know sorry

Explanation:

5 0
2 years ago
Read 2 more answers
I need help..
labwork [276]

Answer:

which app are u using u should use Android studio or if u are using mac book use xcode

5 0
3 years ago
Use System.DateTime along with System.Console to implement a simple C# program that does the following:_______.
Andre45 [30]

Answer:

5

Explanation:

I did it to and it was right

3 0
2 years ago
Other questions:
  • Fix the 2 error codes.
    14·1 answer
  • Budgets help you to do all of the following expect
    15·2 answers
  • What are the ethical implications of online social media after someone has died
    8·2 answers
  • The sample remote access policy document from the hospital that you reviewed in the lab showed that the Remote Access Domain is
    15·2 answers
  • Design an if-then statement ( or a flowchart with a single alternative decision structure that assigns 20 to the variable y and
    5·1 answer
  • A row in a table _____? for computer class and i’m in the middle of a test!
    14·1 answer
  • I CANT DO SKIN MODS ON BRAWLHALLA RIGHT!!!! IM SO MADDDDDDDDDDD
    11·1 answer
  • Multiple choice:
    12·2 answers
  • Write the simplest statement that prints the following: 3 2 1 Go! python
    6·1 answer
  • What would be printed to the screen when the following program is run?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!