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
What technology has a function of using trusted third-party protocols to issue credentials that are accepted as an authoritative
jarptica [38.1K]

Answer: PKI certificates

Explanation: PKI is known as the public key infrastructure which is commonly used for the encryption of the data and also for the data signing. They have the ability to assign the keys pair.

PKI certificates are in the form of strings of alpha-numeric running for a mathematical functions. They use the third party protocols for the execution and they are widely accepted by the authoritative identity.

5 0
2 years ago
PLC software does not typically fail or break​
nydimaria [60]

Answer:

Good to know

Explanation:

:)

7 0
3 years ago
a. displays the sum of all even numbers between 2 and 100 (inclusive). b. displays the sum of all squares between 1 and 100 (inc
LuckyWell [14K]

Answer:

The program required is in the explanation segment.

Explanation:

Program :

import math

# a. displays the sum of all even numbers between 2 and 100 (inclusive).

print("All even numbers from 2 to 100 inclusive ")

sum=0

i=2

while i<=100:

if i %2 ==0:

sum=sum+i

print(i,end=" ")

i=i+1

print("\nThe sum of all even numbers between 2 and 100 (inclusive) :",sum);

#b. displays the sum of all squares between 1 and 100 (inclusive).

print("\nAll squares numbers from 1 to 100 inclusive:")

i=1

sum=0

while i<=100:

print(i*i,end=" ")

i=i+1

sum=sum+(i*i)

print("\n\nThe sum of all squares between 1 and 100 (inclusive) is :",sum)

#c. displays the powers of 2 from 1 up to 256.

print("\nAll powers of 2 from 2 ** 0 to 2 ** 8:")

i=0

while True:

p=math.pow(2,i)

if p>256:

break

print("2 ** ",i," is ",int(p))

i=i+1

#d. displays the sum of all odd numbers between a and b (inclusive), where a and b are inputs

print("\nCompute the sum of all odd integers between two intgers ")

a=int(input("Enter an integer:"))

b=int(input("Enter another integer: "))

count = 0

temp=a

sum=0

while a<=b:

if a%2!=0:

print(a,end=" ")

sum=sum+a

a=a+1

print("\nThe total of the odd numbers from ", temp ," to ", b ,"is",sum)

#e.displays the sum of all odd digits of an input. (For example, if the input is 32677, the sum would be 3 + 7 + 7 = 17.)

print("\nCompute the sum of the odd digits in an integer ")

n=int(input("Enter an integer:"))

count=0

sum=0

temp=n

while n!=0:

rem = n%10

if rem%2!=0:

sum=sum+rem

count=count+1

n=int(n/10)

print("Sum of the odd digits is ",sum)

print("The total of the odd digits in ",temp," is ",count)

4 0
3 years ago
Before donating a computer you should use a program to wipe the hard disk to remove all of its data
Elenna [48]
Yes you should. highly recommended
7 0
2 years ago
Read 2 more answers
When creating a query using the query design command, first you must ____?
Doss [256]

You must first locate the queries group on the create tab. This tab contains the commands used to create queries. MS Access will switch itself to the query design view. A show table dialog box will appear and you will be able to select a table you would want to run a query on.






5 0
3 years ago
Other questions:
  • Which element of presentation software can you use to add callouts and banners?
    9·2 answers
  • Typohunting is registering a domain name that is similar to a trademark or domain name but that is slightly misspelled in hopes
    5·1 answer
  • Software that instructs the computer how to run applications and controls the display/keyboard is know as the
    8·1 answer
  • 6. Which of the following is malware? (1 point)
    10·2 answers
  • What is a IT form? any help would be great thnx
    14·2 answers
  • What runs horizontally and is identified with numbers?
    12·2 answers
  • With ______________, the cloud provider manages the hardware including servers, storage, and networking components. The organiza
    6·1 answer
  • What is a protein called if it loses its shape?
    8·1 answer
  • Write a nested loop to set values as follows: [0] [1] [2] [3] [4] [0] 1 2 3 4 5 [1] 1 2 3 4 5 [2] 1 2 3 4 5 [3] 1 2 3 4 5
    12·1 answer
  • Write short notes about monitor printer and speaker​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!