Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program collects information from the user to create two matrices using a Matrix class definition, and performs several calculations using those matrices. The results

image text in transcribed
image text in transcribed
This program collects information from the user to create two matrices using a Matrix class definition, and performs several calculations using those matrices. The results of each calculation are retrieved and displayed to the user in a readable format.
This program collects information from the user to create two matrices using a Matrix class definition, and performs several calculations using those matrices. The results of each calculation are retrieved and displayed to the user in a readable format.
Number of Rows in Matrix 1: 5 Number of Columns in Matrix 1: 2 Values of Matrix 1 (expecting 10): 6 7 10 3 5 31 0 9 2 Note: You must use the above format for entering the values of the matrix. When entering values to fill a matrix, all values should be provided on one line. 3. Performs the following calculations and prints each result using the print function Each of the four matrix mathematical methods should be called, each result stored in a new object If the dimensions of the two matrices involved do not allow for the operation to be performed, skip performing this calculation, and display a message stating that step has been skipped. o For example, if I have a 3x4 matrix and a 4x2 matrix, I cannot add or subtract these together, but I can perform multiplication Each calculation should be printed with a full explanation o For scalar multiplication, you can either use an integer literal or generate a random integer. Just be sure to print the value of the integer value as part of the output when performing this function. o The calculation being performed should be explained; and the contents of each matrix or value involved should be printed and identified. A matrix is rectangular array of items laid out in rows and columns. The dimensions, or size, of a matrix can be expressed as mxn or m-by-n, where m is the number of rows in the matrix and n is the number of columns in the matrix. For example, consider A, which is the following 2 x 4 matrix: 5 13 1 4 2 31 4 10 The individual elements in A can be expressed as ou, where i (the rowl is a number from 1 to m and column) is a number from 1 to n. For example, the value at element d is 2. the Write a program (called matrix.cpp) that does that following: 1. Implement a class called Matrix that: make the same line can >> >> double >> char Contains private member fields for the number rows and columns of the matrix Contains a public member field to contain the matrix elements o This should be a 2D array of integers that is implemented dynamically Contains five public functions o add function, that adds two same sized matrices together and returns a new matrix with the result o subtract function, that subtracts two same sized matrices together and returns a new matrix with the result o multiply function, that performs proper matrix multiplication and returns a new matrix with the result o scalar function, that performs scalar multiplication with an integer value and a matrix, and returns a new matrix with the result o print function, that outputs the contents of the matrix in tabular form that matches the dimensions of the matrix Contains a non-default constructor O Constructor that accepts size information, and dynamically creates the matrix Contains a destructor o That properly handles discarding the dynamically created 2D array (using delete and setting the member field to null 2. Prompts the user for: . The dimensions of a first matrix The contents of the first matrix, which is then filled into the newly created matrix object instance. The dimensions of a second matrix The contents of the second matrix, which is used to fill the newly created matrix instance Sample prompts with appropriate user responses

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions

Question

Find the power absorbed by the network shown. 21 V 12 k 18 k

Answered: 1 week ago

Question

Compare and contrast cultural preferences for online privacy

Answered: 1 week ago

Question

What is digital literacy? Why is it necessary?

Answered: 1 week ago