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]
4 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]4 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
Let A and B be two stations attempting to transmit on an Ethernet. Each has a steady queue of frames ready to send; A’s frames w
Mariana [72]

Answer:

Following are the solution to the given question:

Explanation:

Please find the complete and correct question in the attachment file.  

For Point a:

For the second round,

A is selects kA(2)  either 0 or 1, so for each of them, that is \frac{1}{2}.

B selects kB(2)\  from\  (0, 1, 2, 3) for each choice with the probability of \frac{1}{4}.

If kA(2) < kB(2) wins the second rear race.

\to P[A \ wins] = P[kA(2) < kB(2)]

                     = P[kA(2) = 0] \times P[kB(2) > 0] + P[kA(2) = 1] \times P[kB(2) > 1]\\\\= \frac{1}{2} \times \frac{3}{4}  + \frac{1}{2}  \times \frac{2}{4} \\\\=\frac{3}{8}  +\frac{2}{8} \\\\= \frac{3+2}{8}\\\\= \frac{5}{8}

For Point b:

Throughout this example, kA(3) also selects to be either 0 or 1 with such a \frac{1}{2} probability. So, although B chooses kB(3) from (0, 1, 2, 3, 4, 5, 6, 7), the probabilities each are \frac{1}{8}:

\to P[A \  wins] = P[kA(3) < kB(3)]

                     = P[kA(3) = 0] \times P[kB(3) > 0] + P[kA(3) = 1] \times P[kB(3) > 1]\\\\= \frac{1}{2} \times \frac{7}{8} + \frac{1}{2} \times \frac{6}{8}\\\\= \frac{7}{16} + \frac{6}{16}\\\\= \frac{7+6}{16} \\\\= \frac{13}{16}\\\\

For point c:

Assume that B tries again 16 times (typical value), and it destroys. In addition, throughout the exponential background n is obtained at 10 when choosing k between 0 to 2n−1. The probability of A winning all 13 backoff events is: P[A \text{wins remaining races}] = 16\pi i =4P[A \ wins \ i |A \ wins \ i -1 ]

Let the k value kA(i) be A for the backoff race I select. Because A retains the breed

=(kA(i)] \cdot P[kA(i+ 1)< kB(i+ 1)] \geq P[kA(i) + 1

For point d:

Two stations A and B are supposed. They assume that B will try 16 times afterward. Even so, for A, 16 races were likely to also be won at a rate of 0.82 For Just higher expectations of three A, B, and C stations. For Station A, possibility to win all backoffs

3 0
3 years ago
Add an array, which will store the most recent 5 recent transactions. For the array, add an insert function which will store the
Vika [28.1K]

The answer & explanation for this question is given in the attachment below.

Download docx
4 0
3 years ago
How to remove a course from your canvas calander feed.
Ilya [14]

Answer:

Access Canvas, then click the Calendar link from the navigation menu on the left.Click the Agenda tab.Make sure that all the entries you'd like to remove are displayed. ...Click the entry you'd like to remove then click Delete.Click Delete to confirm

Explanation:

Read Carefully and Take it Step by Step

That's it

5 0
2 years ago
Which of the following is NOT a recommended characteristic for incident objectives?A. Stated in broad terms to allow for flexibi
docker41 [41]

Answer:

A. Stated in broad terms to allow for flexibility.

Explanation:

Incident command are controls or directives needed in production or in an organization. A few characteristics not incident command objectives are, all projects and targets must be measurable and attainable, aii hand on board must function in accordance with the incident commander's authorities, and every finished project must meet company quality standards and deadlines. The incident commander's authorities are fixed for a particular sector and is rigid.

6 0
3 years ago
I need help also this counts as my second giveaway and last for today
kifflom [539]

Answer:

I am pretty sure its the Visual card

8 0
3 years ago
Read 2 more answers
Other questions:
  • What is the Web of Trust?
    12·1 answer
  • Submit your 300-word essay describing the equipment usedI in a well-equipped studio’s audio department and the training and expe
    8·2 answers
  • A restaurant bill comes to $28.35. Find the total cost if the tax is 6.25% and a 20% tip is left on the amount before tax.​
    6·1 answer
  • 14. What is the simplest way to permanently get rid of an unwanted file?
    9·1 answer
  • Adding _______ around calculations indicates which calculations should be performed first before following the typical order of
    6·2 answers
  • Microsoft acknowledged that if you type a res:// url (a microsoft-devised type of url) which is longer than ____ characters in i
    9·1 answer
  • In order to recover from an attack on any one server, it would take an estimated 14 hours to rebuild servers 1, 2, 3, and 4 and
    6·1 answer
  • What are some other ways to program a robot to navigate a complicated environment other than straight paths and right angle (90
    8·2 answers
  • Open excel program then use the (IF) function to fill the column of (Expensive/Cheap) then save your
    9·1 answer
  • Write a Java program that will be able to generate the sample table below.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!