Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

You are to write a program that provides the user with a menu of choices that have to do with performing operations on two-dimensional arrays. In particular, the menu should provide the following options:

Addition of matrices
Scalar Multiplication
Multiplication of matrices
Determinant (only for 2 X 2 or 3 X 3 matrix)
Exit

The user should be allowed to request for multiple operations within a session. In other words, your main program should have a loop that calls a method menu until the user selects option 5. See below for more information on each of the options.

Option 1) You will need a method to prepare for the addition of matrices and to call a method to print the result. You should get the dimensions of the matrix from the user, print a message if the addition is undefined; otherwise get the matrices from the user, call a method add that takes the two matrices as input and returns the sum matrix, then call a method to print the resulting matrix.

Option 2) You will need a method to prepare for the scalar multiplication (e.g. each entry of the matrix is multiplied by an integer value.) and to call a method to print the result. You should get the dimensions of the matrix from the user and the integer value that will act as a scalar, call a method scalarMultiply that takes the matrix and integer value as input and returns a new matrix as the result. Then call a method to print the resulting matrix.

Option 3) You will need a method to prepare for the multiplication of matrices and to call a method to print the result. You should get the dimensions of the matrix from the user, print a message if the multiplication is undefined; otherwise get the matrices from the user, call a method multiply that takes the two matrices as input and returns the product matrix, then call a method to print the resulting matrix.

Option 4) You will need a method to prepare for calculating the determinant (the product of the entries on the main diagonal minus the product of the entries on the lesser diagonal). You should get the dimensions from the user. If the matrix is square, but not 2 X 2 or 3 X 3, you should inform the user that this program only calculates the determinant for 2 X 2 or 3 X 3 matrices. If the user enters the dimensions of a non-square matrix, then the message should be that determinants can only be calculated for square matrices. If the user enters the dimensions of either a 2 X 2 matrix or 3 X 3 matrix, read the matrix and call a method determinant that takes the matrix and the square size as parameters, and then prints a message with the result.

Notes:

Besides the 4 matrix operations, you will need methods to print the contents of a two-dimensional array and to read data, row by row, into a two dimensional array.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9901940

Have any Question?


Related Questions in Computer Engineering

A soda vendor at aloha stadium noticed that during rainbow

A soda vendor at Aloha Stadium noticed that during Rainbow Warrior football games that more soda is being served the warmer the temperature during game time. Based on 40 home games covering the past 5 years, the vendor e ...

Going to concerts and reading books take time and money

Going to concerts and reading books take time and money. Suppose a book costs $10 and takes 3 hours to read and a concert costs $20 and takes 3 hours. For a person with $80 to spend and 18 hours for these activities: a. ...

Suppose mpc is 07 government spending increases by 10

Suppose MPC is 0.7. Government spending increases by $10 billion, and taxes decrease by $5 billion. How would the following items change, and by how much? Disposable income Private saving Public( Government) saving Equil ...

1 the lab manual instructs you to heat camphor at position

1.) The lab manual instructs you to heat camphor at position 2 on the hot plate, which is a moderately low setting. What would be a problem of heating the camphor too quickly? 2.) A mixture of ammonium chloride, sand, an ...

A substring is a contiguous sequence of characters from a

A substring is a contiguous sequence of characters from a string. For example, "cde" is a substring of the string "abcdefg". We say that substring s1 is duplicated in string s if s1 shows us in s at least two times, with ...

Chebyshevs theorem is used to approximate the proportion of

Chebyshev's theorem is used to approximate the proportion of observations for any data set, regardless of the shape of the distribution. Assume that a distribution has a mean of 255 and standard deviation of 20. Approxim ...

Need guidance on a c program that1 asks the user to input a

Need guidance on a C++ program that: 1. Asks the user to input a number of cents 2. Calculates and displays the number of quarters, dimes, nickels, and pennies that should be used to reach the value. EX: 67 cents would b ...

Suppose a machine has 16 registers and uses 24 bit memory

Suppose a machine has 16 registers and uses 24 bit memory addresses. The opcodes are 8 bits so that the instruction length is 32 bits. Register instructions can have two or three register operands (4 bits to name each re ...

Explain the risk of having hacking tools installed on your

Explain the risk of having hacking tools installed on your computer and why you should contact local law enforcement agencies before installing those tools.

Step 1 pick a home appliance with significant user controls

Step 1: Pick a home appliance with significant user controls (e.g. Microwave, Stove/Range, Refrigerator, etc.). Do NOT select things like a TV remote control, computers, etc. Also do not select equipment that lack signif ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As