Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use easiest way to code and use all info in the pics. Lab #3b:Neo Math Submit the following in Canvas: 1-Output (your output cut-and-pasted into

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribedUse easiest way to code and use all info in the pics.
Lab #3b:Neo Math Submit the following in Canvas: 1-Output (your output cut-and-pasted into a text file called ScreenlO.txt created in NetBeans) 2- Source Code (your Matrix.java and testMatrix.java source files) Two matrices can be added or subtracted if they have the same size. Suppose A (au] and B- lbu] are two matrices of the size mxn, in which ay denotes the element of A in the ith row and the jth column, and so on. The sum and difference of A and B are given by: The multiplication of A and B (A B) is defined only if the number of columns of A is the same as the number of rows of B if A is of the size m x n and B is of the size n t, the A-B-C (represented by Ical) is of the size m x t and the element cia is given by the formula: C anbk+aabz+.ainbnk Create a class Matrix with the following: // data members private final int (1values private final String name: holds the matrix values // constructors public Matrix (String name, int1 values) public Matrix(int[101 values) II name is set to null // nethods publio Matrix add (Matrix mIreturns null if operation is not possible else this plus public Matrix sub (Matrix m) returns nul1 if operation is not possible else this minus m public Matrix mult(Matrix m)1) returns null if operation is not possible else this times m publie string getane II returns the matrix name // tostring override. Make sure the 80verride annotation is there too / Use a StringBuffer to construct the matrix output with a Formatter to use a field width of 3 /l for each matrix value and with each value on a row separated by one space. If name is not // null, then output the name with the format name: on the first output 1ine. Output the matrix /I values as a 2D table with aforementioned formatting. Note that with this override, you can // simply output a Natrix m using System.out.peintin (n)a Override publie String tostring) I/ output name and values in a table - see example Create a test class TestMatrix (in the Netbeans Test Packages source folder) that reads up to ten (10) integer matrices from input file matrices.txt and creates an array of Matrix objects that represent them (hint: you should use a while loop for this!). Each matrix in the input file consists of a line with the matrix name, number of rows and number of columns, followed by a line for each row. Note that you Page 1 of 4

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_2

Step: 3

blur-text-image_3

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

Students also viewed these Databases questions

Question

Why does sin 2x + cos2x =1 ?

Answered: 1 week ago

Question

What are DNA and RNA and what is the difference between them?

Answered: 1 week ago

Question

Why do living creatures die? Can it be proved that they are reborn?

Answered: 1 week ago

Question

1. What might have led to the misinformation?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago