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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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