Write a program that provides the user with a menu of choice

Assignment Help Computer Engineering
Reference no: EM13322638

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.

Reference no: EM13322638

Questions Cloud

What is the resistance of the toy car : A toy car is driven by a battery of 9 V. It draws a current of 2mA. What is the resistance of the toy car
Find an isomorphic between the boolean algebra : Find an isomorphic between the boolean algebra with set b ={ 0,1,p,p' } in formal logic and the boolean algebra wih set p({a,b}).
Determine the location of the image and the magnification : An object is placed 40cm in front of a concave mirror whose radius of curvature is 30am. Determine the location of the image and the magnification
Define what effect on the value of ca(oh)2''s ksp : What effect on the value of Ca(OH)2's Ksp (6.5x10^-6 ) would sucking up some suspended calcium hydroxide solid have. Would the Ksp value be higher or lower than the normal value. Why
Write a program that provides the user with a menu of choice : 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.
Determine the absolute air pressure on top of reservoir 1 : Two water reservoirs A and B are connected to each other through a 40 m long, 2 cm cast iron pipe with a sharp-edged entrance. The pipe also involves a swing check valve and a fully open gate valve.
What is the expected monthly bill : a student consumes an average electric power of 5 k W and 4 hours per day. what is the expected monthly bill if the electricity costs 11 cents per kwh
How much styrene transfers to the ethylene glycol phase : The distribution coefficient of styrene distributed between ethylbenzene and ethylene glycol at 25 degrees C is .19 mass fraction in the ethylene glycol phase per mass fraction in the ethylbenzene phase.
Find the angle between the incident beam and reflected beam : A beam of light is incident on a plane mirror at an angle of 30 degrees to the normal of the mirror. find the angle between the incident beam and reflected beam

Reviews

Write a Review

Computer Engineering Questions & Answers

  A program that would calculate and print the parking charges

A parking garage charges a atleast fee of $2.00 to park for up to 3 hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of 3 hours.

  You can push multiple operands on the stack

You can push multiple operands on the stack. The operation will always use the two topmost values. For example, to evaluate (A+B+C), you can use the code below:

  How to use the ''time'' function and the difftime function

The two searches to use for comparisons are the Linear Search and the Binary Search. You will search for 1000 strings in the array of 3000 strings and find out the average number of probes needed to find a match. The target string would be a rando..

  Declare the iterator iter for an integer list

define the list object intList that holds the integers from the array arr.suppose iter is set to the start of the list.

  How can we use foreign key constraints

How can we use Foreign Key constraints. How may we create new View on one or more tables ?

  Define the types of the expressions

Using no other objects besides those already declared, how may you alter ptrPtr so that is points to a pointer to b without directly touching ptr?

  Determining the output

Specify the output if input is diamond diamond? State the output if the input is diamond gold?

  Short paper on your servers performance

A solid amount of statistics, you should write a short paper on your server's performance. Point out bottlenecks and analyze the data that you've gathered, as well as coming up with a few suggestions on how you may be able to increase performance

  Make perl script in order to display a basic web page

design a Perl script in order to display a basic Web page and display system information that is dynamic using Perl on the screen such as date and time as well as the host and how long system has been up.

  What are the legal and regulatory ramifications

explain one e-Business failure. Explain what happened and what you would have done differently. Explain whether or not the e-Business practiced sound financial planning.

  Computer rendering of stochastic models

Prepare a slideshow on Computer rendering of stochastic models

  What is structured programming

Suppose f is a function that returns the result of reversing the string of symbols given as its input, and g is a function that returns the concatenation of the two strings given as its input. If x is the string abcd, what is returned by g(f(x),x)..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd