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
Your task is to design and build an apparatus that replicates the lower arm and biceps muscle system. The equipment used are a B
QveST [7]

Answer:

Check the explanation

Explanation:

Kindly check the attached images below to see the diagram design to solve the above question.

5 0
4 years ago
A tensile test was made on a tensile specimen, with a cylindrical gage section which had a diameter of 10 mm, and a length of 40
tamaranim1 [39]

Answer:

The answers are as follow:

a) 10 mm

b) 12.730 N/mm^{2}

c) 127.307 N/mm^{2}

d) 0.25

Explanation:

d1 = 10mm , L1 = 40 mm, L2 = 50 mm, reduction in area = 90% = 0.9

Force = F =1000 N

let us find initial area first, A1 = pi*r^{2} = 78.55 mm^{2}

using reduction in area formula : 0.9 = (A1 - A2 ) / A1

solving it will give,  A2 = 0.1 A1 = 7.855  mm^{2}

a) The specimen elongation is final length - initial length

50 - 40 = 10 mm

b) Engineering stress uses the original area for all stress calculations,

Engineering stress = force / original area  = F / A1 = 1000 / 78.55  

Engineering stress = 12.730 N / mm^{2}

c) True stress uses instantaneous area during stress calculations,

True fracture stress = force / final  area  = F / A2 = 1000 / 7.855

True Fracture stress = 127.30 N / mm^{2}

e) strain = change in length / original length

strain = 10 / 40  = 0.25

8 0
3 years ago
Consider a steam turbine, with inflow at 500oC and 7.9 MPa. The machine has a total-to-static efficiency ofηts=0.91, and the pre
sergiy2304 [10]

Answer: \dot m_{in} = 23.942 \frac{kg}{s}, \dot H_{out} = 39632.62 kW

Explanation:

Since there is no information related to volume flow to and from turbine, let is assume that volume flow at inlet equals to \dot V = 1 \frac{m^{3}}{s}. Turbine is a steady-flow system modelled by using Principle of Mass Conservation and First Law of Thermodynamics:

Principle of Mass Conservation

\dot m_{in} - \dot m_{out} = 0

First Law of Thermodynamics

- \dot W_{out} + \eta\cdot (\dot m_{in} \dot h_{in} - \dot m_{out} \dot h_{out}) = 0

This 2 x 2 System can be reduced into one equation as follows:

-\dot W_{out} + \eta \cdot \dot m \cdot ( h_{in}- h_{out})=0

The water goes to the turbine as Superheated steam and goes out as saturated vapor or a liquid-vapor mix. Specific volume and specific enthalpy at inflow are required to determine specific enthalpy at outflow and mass flow rate, respectively. Property tables are a practical form to get information:

Inflow (Superheated Steam)

\nu_{in} = 0.041767 \frac{m^{3}}{kg} \\h_{in} = 3399.5 \frac{kJ}{kg}

The mass flow rate can be calculated by using this expression:

\dot m_{in} =\frac{\dot V_{in}}{\nu_{in}}

\dot m_{in} = 23.942 \frac{kg}{s}

Afterwards, the specific enthalpy at outflow is determined by isolating it from energy balance:

h_{out} =h_{in}-\frac{\dot W_{out}}{\eta \cdot \dot m}

h_{out} = 1655.36 \frac{kJ}{kg}

The enthalpy rate at outflow is:

\dot H_{out} = \dot m \cdot h_{out}

\dot H_{out} = 39632.62 kW

3 0
3 years ago
A five legged intersection has safety issues. in 2018, the number of crashes reported was 48 and the average 24 hour volume ente
sashaice [31]

Answer:

The crash rate is 22 vehicles per 1 million vehicles

Explanation:

In this question, we are asked to determine the crash rate per million vehicles.

Crash rate is calculated using average crash frequency.

The crash rates are calculated based on the number of crashes per million vehicle miles travelled in a year.

Mathematically;

crash rate = (48 * 1,000,000)/ [(980 + 1560 + 1230 + 900 + 1435)* 365]

= 48,000,000/(6105*365)

= 21.54 approximately 22

4 0
4 years ago
What type of engineer would be most likely to develop a design for cars? chemical civil materials mechanical
Andreyy89
I don’t know but good luck
4 0
3 years ago
Other questions:
  • The denominator of a fraction is 4 more than the numenator. If 4 is added to the numenator and 7 is added to the denominator, th
    15·1 answer
  • A spacecraft starts in elliptical orbit JK (red solid curve) around some planet and transfers to elliptical orbit MN (blue solid
    7·1 answer
  • You are ordering steel cable for a 250 foot long zip-line you are building in your back yard. The cable can be ordered in diamet
    6·2 answers
  • What is usually the strongest part of a unibody
    8·1 answer
  • 19. Write a C program that converts an uppercase character to a lowercase character. Declare function char toLower(char ch); to
    5·1 answer
  • Research 3 different type of surveying jobs. Write a short essay on your favorite job.
    11·2 answers
  • Two technicians are discussing how to loosen bleeder valves. Technician A says that a shock is usually necessary to break the ta
    8·1 answer
  • What is An ampere is
    15·2 answers
  • If a bicycle has 2 gears in the front, and 5 in the rear, how many different combinations of gears are possible?
    10·1 answer
  • Correctly complete the statement below with the appropriate term.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!