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

  What is the definition of a crm

What features does the Internet advertising survey recommend for online marketing campaigns.

  Outline the importance of support systems and mechanisms

examine how creating Risk Management, Scope Change Control, and Communication Plan can help improve the management of any project.

  Program to insert the name cervantes

"In the following exercises, suppose that the Simple combo box appears as shown and that the Sorted property is set to True. Give a statement or statements that will carry out the stated task."

  What are race situations difficult to debug

assume the legislature in your state is debating the adoption of UCITA and you have been known as an expert witness. What are the three most important ideas you want your legislators to get from the testimony.

  Program declaring an integer variable

Write down a complete program that declares an integer variable, reads a value from keyboard into that variable.

  The shipping clerk at the rinky dooflingy company is faced

Write a program that reads the number of dooflingies to be shipped and displays the number of huge, large, medium, and small containers needed to send the shipment in the atleast number of containers and with the minimum amount of wasted space.

  Pros and cons of these three approaches

It is possible to design and edit web pages in a number of ways. For example, we could edit HTML tags by hand, use a visual editor such as Dreamweaver or use an HTML generator to edit a layout and then create the HTML from it.

  Write a program that reads in a list of positive integers

Write a program that reads in a list of positive integers. Write down a program which asks user to respond to a question by entering either 1 for yes or 2 for no.

  What the command does, how it might be used

What the command does, how it might be used.

  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.

  Why the file manager should grant such requests

why the file manager should grant such requests.

  Utilizing the rsa protocol encrypt and decrypt messages

You are asked to hand-turn the RSA protocol in order to encrypt and decrypt the messages (utilizing smaller numbers than are used in the practice, so that calculations may be done through the hand).

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