Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ matrix calculator 2 PLEASE READ ALL THE QUESTION CAREFULLY AND DO EXACTLY AS IT ASKS. ANYTHING ELSE WONT BE ACCEPTED. It is required to
C++ matrix calculator 2 PLEASE READ ALL THE QUESTION CAREFULLY AND DO EXACTLY AS IT ASKS. ANYTHING ELSE WONT BE ACCEPTED. It is required to design and implement an extension to the calculator created in the first milestone to support more functionalities to be done on matrices. Operations that will be supported in this second milestone are: 1- Matrix Transpose 2- Matrix Inverse 3- Matrix Determinant The matrix should be entered by the user in the following format: [1 2 5, -18 14.2, 7.01 - 18 99.3] which is the format equivalent to a 3x3 matrix as shown: 1 2 5 -1 8 14.2 17.01 -18 99.3 Input Format (THE USER SHOULD WRITE THE MATRIX IN A STRING FORMAT) The matrix should be entered by the user in the following format: [1 25,-18 14.2, 7.01 - 18 99.3] which is the format equivalent to a 3x3 matrix as shown: 1 2 5 -1 8 14.2 17.01 -18 99.3) User can choose between the different operations as follows: In case of Transpose: user types one matrix only then enters capital 'T' letter as shown: [1 2 4, 9 3 7] . [1 9, 2 3, 4 7] In case of Inverse: user types one matrix only then enters capital 'I' letter as in the case of transpose. In case of Determinant: user types one matrix only then enters capital 'D' letter, and the output should be shown as a number. Constraints User will input string as shown previously: Example for a 3x4 matrix, it should be witten as follows (-0.1 2 5,-18 14.2, 7.01 -18 99.3, 15.0-99.24 18] User will input the matrix of size nxm; where 0 NOTE: AGAIN THE USER WILL CHOOSE THE SIZE OF EACH MATRIX Important Note If the user enters a matrix in an incorrect format (other than the stated input format) your program must detect that and output the word "ERROR!" (MUST BE WRITTEN AS SHOWN, don't forget the exclamation mark, and note that all letters are capitals) For Example: [1 2 4, 4 7, 8] + [-5 3 5, 7 6 1] ERROR! Your program should validate the mathematical conditions to do the different operations, for example: In the determinant, you should check if the matrix given can have a determinant or not. If not, you should output "ERROR!" to the user. Also, in the inverse case, you should detect the validity of the inversion. If no validity, your program should output an "ERROR!" Output Format The output should be a matrix of the result printed on a new line as shown previously. In case of the determinant, the output should be the value of the determinant of the matrix only. Also, the error message should be in the following format: "ERROR!" on a new line as shown in the examples above. NOTE: In the case of decimal point output you should set the precision of the output to 2 decimal point places Sample Input 0 THE INPUT SHOULD LOOK EXACTLY LIKE THIS FORMAT [59-8-9-1,-2178 21 T Sample Output 0 THE OUTPUT SHOULD LOOK EXATLY LIKE THIS FORMAT [5-2,91,-87,-98,-12] Sample Input 1 THE INPUT SHOULD LOOK EXACTLY LIKE THIS FORMAT [123,670,01 2] I Sample Output 1 THE OUTPUT SHOULD LOOK EXATLY LIKE THIS FORMAT [1.75 -0.12 -2.62,-1.5 0.25 2.25, 0.75 -0.12 -0.62] NOTE: don't use class or OOP
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started