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
lianna [129]
1 year ago
14

Q4 a.

Engineering
1 answer:
dedylja [7]1 year ago
7 0

The Java program that accepts a matrix of M × N order and then interchanges diagonals of the matrix is given below:

<h3>Steps:  </h3>
  • 1. We can only interchange diagonals for a square matrix.
  • 2. Therefore, we would have to create a square matrix of size [M × M].
  • 3. We would check whether the matrix is a square matrix or not. If the matrix is square then follow step 3 else terminate the program.
  • 4. Apply logic for interchange diagonal of the matrix some logic is given below.

<h3>Java Code</h3>

//  Java Program to Accept a Matrix of Order M x N &

//  Interchange the Diagonals

import java.util.Scanner;

public class InterchangeDiagonals {

   public static void main(String[] args)

   {

       // declare variable

       int m, n, i, j, temp;

       // create a object of scanner class

       Scanner sc = new Scanner(System.in);

       System.out.print("Enter number of rows ");

       // take number of rows

       m = sc.nextInt();

       System.out.print("Enter number of columns ");

       // take number of columns

       n = sc.nextInt();

       // declare a mxn order array

       int a[][] = new int[m][n];

       // if block it's execute when m is equals to n

       if (m == n) {

           System.out.println(

               "Enter all the values of matrix ");

           // take the matrix inputs

           for (i = 0; i < m; i++) {

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

                   a[i][j] = sc.nextInt();

               }

           }

           System.out.println("original Matrix:");

           // print the original matrix

           for (i = 0; i < m; i++) {

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

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

               }

               System.out.println("");

           }

          // perform interchange

           for (j = 0; j < m; j++) {

               temp = a[j][j];

               a[j][j] = a[j][n - 1 - j];

               a[j][n - 1 - j] = temp;

           }

           System.out.println(

               " after interchanging diagonals of matrix ");

           // print interchanged matrix

           for (i = 0; i < m; i++) {

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

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

               }

               System.out.println("");

           }

       }

       // else block it's only execute when m is not equals

       // to n

       else {

           System.out.println("Rows not equal to columns");

       }

   }

}

Read more about java programming here:

brainly.com/question/18554491

#SPJ1

You might be interested in
An alloy is evaluated for potential creep deformation in a short-term laboratory experiment. The creep rate is found to be 1% pe
LenaWriter [7]

Answer:

a) Q = 251.758 kJ/mol

b) creep rate is    = 1.751 \times 10^{-5} \% per hr

Explanation:

we know Arrhenius expression is given as

\dot \epsilon =Ce^{\frac{-Q}{RT}

where

Q is activation energy

C is pre- exponential constant

At 700 degree C creep rate is\dot \epsilon = 5.5\times 10^{-2}% per hr

At 800 degree C  creep rate is\dot \epsilon = 1% per hr

activation energy for creep is \frac{\epsilon_{800}}{\epsilon_{700}} = = \frac{C\times e^{\frac{-Q}{R(800+273)}}}{C\times e^{\frac{-Q}{R(700+273)}}}

\frac{1\%}{5.5 \times 10^{-2}\%} = e^{[\frac{-Q}{R(800+273)}] -[\frac{-Q}{R(800+273)}]}

\frac{0.01}{5.5\times 10^{-4}} = ln [e^{\frac{Q}{8.314}[\frac{1}{1073} - \frac{1}{973}]}]

solving for Q we get

Q = 251.758 kJ/mol

b) creep rate at 500 degree C

we know

C = \epsilon e^{\frac{Q}{RT}}

    =- 1\% e{\frac{251758}{8.314(500+273}} = 1.804 \times 10^{12} \% per hr

\epsilon_{500} = C e^{\frac{Q}{RT}}

                         = 1.804 \times 10^{12}  e{\frac{251758}{8.314(500+273}}

                         = 1.751 \times 10^{-5} \% per hr

4 0
2 years ago
Explain about Absolute viscosity, kinematic viscosity and SUS?
ArbitrLikvidat [17]

Answer:

Absolute viscosity is the evaluation of the resistance (INTERNAL) of the fluid  flow

Kinematic viscosity relates to the dynamic viscosity and density proportion.

SUS stands for Sabolt Universal Seconds. it is units which described the variation of oil viscosity

Explanation:

Absolute viscosity is the evaluation of the resistance (INTERNAL) of the fluid  flow, whereas Kinematic viscosity relates to the dynamic viscosity and density proportion. fluid with distinct kinematic viscosities may have similar dynamic viscosities and vice versa.Dynamic viscosity provides you details of  power required to make the fluid flow at some rate, however kinematic viscosity shows how quick the fluid moves when applying a certain force.

SUS stands for Sabolt Universal Seconds. it is units which described the variation of oil viscosity when change with change in temperature. it is measured by using viscosimeter.

3 0
3 years ago
Write a statement that calls the recursive method backwardsAlphabet() with parameter startingLetter.
Tcecarenko [31]

Recursion refers to the act of calling a function itself. With the use of this strategy, complex problems can be reduced to more manageable, simpler ones. Recursion might be a little challenging to comprehend. The best method to figure out how it works is to experiment with it.

<h3>How to write a programme by recursive method ?</h3>

The process of making a function call itself is known as recursion. With the use of this strategy, complex problems can be reduced to more manageable, simpler ones. Recursion might be a little challenging to comprehend. Experimenting with it is the most effective way to learn how it functions.

public class Recursive Calls {

public static void backwards Alphabet(char currLetter) {

if (currLetter == 'a') {

System.out.println(currLetter);

}

else {

System.out.print(currLetter + " ");

backwards Alphabet(--currLetter);

}

return;

}

public static void main (String [] args) {

char starting Letter = '-';

starting Letter = 'z';

// Your solution goes here

backwards Alphabet(starting Letter);

return;

}

}

To learn more about recursive method refer to :

brainly.com/question/24167967

#SPJ4

6 0
1 year ago
Question 9 of 25
mafiozo [28]

Answer:

D

Explanation:

took test failed question D is the right answer

3 0
3 years ago
An aluminum metal rod is heated to 300oC and, upon equilibration at this temperature, it features a diameter of 25 mm. If a tens
Natalka [10]

Answer:

It will results in mechanical hardening.

5 0
3 years ago
Read 2 more answers
Other questions:
  • Who does the narrator blame for the loss of her job as editor-in-chief? <br> see if i care readworks
    8·2 answers
  • #5 Air undergoes an adiabatic compression in a piston-cylinder assembly from P1= 1 atm and Ti=70 oF to P2= 5 atm. Employing idea
    13·1 answer
  • What are the units or dimensions of the shear rate dv/dy (English units)? Then, what are the dimensions of the shear stress τ= μ
    14·1 answer
  • Which of the following is not one of the systems required to ensure the safe and correct operation of an engine?
    5·1 answer
  • Which of the following statements about pitot-static systems is FALSE? a). A pitot probe measures the Total Pressure of the free
    10·1 answer
  • Describe with an example how corroded structures can lead to environment pollution? ​
    13·1 answer
  • State 3 advantages and 3 disadvantages of unit rate contract​
    10·1 answer
  • What is the scope of hazard review in a worksite analysis
    7·1 answer
  • What happens to the electrolyte, during discharging?
    9·1 answer
  • Which type of system is being researched to deliver power to several motors to drive multiple systems in vehicles?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!