GSP295—Week 1 iLab
A Simple ADT (70 points)
Grading Rubric Points
SquareMatrix Specification 10
SquareMatrix Implementation 25
SquareMatrix Test Driver 14
Test Plan and Lab Write-Up 14
Create a single zip file including the following.
– A Word document containing your specification for Part 1
– Your Visual Studio Project directory and associated files, including source files for Parts 2–4.
– The results of your testing from Part 5. What tests did you run? Did everything work okay? Are there outstanding issues in your program? A short ½–1-page summary of your results is about the right length.
If you document any issues, it will be easier to isolate any problems, provide detailed help, and could potentially improve your grade.
For this Lab, create a simple ADT modeled after the mathematical concept of a matrix. Using this ADT, create a test driver that allows a user to perform all matrix operations.
(Note: For this exercise, you may find the Chapter 2 case study very helpful as a reference.)
Defining a SquareMatrix
A SquareMatrix is an NxN matrix. For example, one SquareMatrix of order N = 2 is the following.
A square matrix can be represented by a two-dimensional array with N rows and N columns. You can assume, for the purposes of this iLab, that the maximum value of N is 50. You can use static memory allocation so you do not have to worry about the details of dynamic memory here. It’s fine to “waste” space by allocating enough space for a 50 x 50 matrix.
Part 1: Specification
Write a specification for the SquareMatrix ADT. Remember, an ADT specification should have function, precondition, postcondition, parameters (with types), and return values (with types) for each method. Include at least the following operations.
• MakeEmpty(n), which sets the first n rows and columns to 0 and can perform other initialization operations as needed
• StoreValue(i,j,value), which stores the given value into the [i,j] position of the matrix
• Add, which adds two matrices together. You should allow a parameter to store the result.
• Subtract, which subtracts one matrix from another. You show allow a parameter to store the result.
• Print, which outputs the matrix to the console. It is fine to use a simple format such as the one given in the SquareMatrix example above.
• Copy, which copies one matrix into another
You may assume integers for parameters (or floats if you prefer, but you do not have to worry about template types; simply choose int or float).
You should use the parameter (n) to MakeEmpty as the given size of the matrix. In other words, in testing, you can assume you will always make a call to MakeEmpty first, which sets the size of the matrix. For all cases where the user tries to perform operations that are invalid on a matrix (such as adding or subtracting matrices of different sizes), it’s fine to output an error and simply refuse to perform the operation. However, you should make sure you check for these cases and output an error!
You may assume that Add and Subtract take a parameter “result” that is a SquareMatrix where the result is stored. For Copy, you may assume that one matrix is copied into the other and overwritten. Make sure you document which one is overwritten!
Part 2: Class Declaration
Convert your specification to a C++ class declaration. Remember to comment it well! It should compile; make sure it does before moving on to Part 3.
Part 3: Implement the Member Functions
Implement the individual member functions from your SquareMatrix ADT. Make sure everything compiles and comments well. You should have class-level comments, member function/method/variable level comments, and in-line comments.
Part 4: Create a Driver
Now that you are done, are you sure it works? Create a Main function that will provide a driver or interface to your program. Your driver should hold three SquareMatrix datatypes referred to below as positions 1, 2, and 3. Hence you can test an add/subtract by creating a matrix in positions 1 and 2 and then adding them with the result in position 3.
The test driver should prompt the user in a simple menu fashion (in text on the console). There’s no need to get fancy here. A simple multiple choice input is fine (type the letter of the command you want). You can ask for parameters separately on a new line with a prompt or simply pass them in one line—it’s your choice. For example, either “a 1” or “a” then “1” is fine for the create process.
You should create three instances of SquareMatrix so you can test all the ADT functions. Your test driver should have at least the following capabilities.
a) Create new SquareMatrix and store in position 1, 2, or 3
b) MakeEmpty ‘n’ rows/columns from matrix position 1, 2, or 3
c) StoreValue i,j,value to the matrix in position 1, 2, or 3
d) Add matrices in one position to another.
e) Subtract matrices in one position from another.
f) Print the matrix in a particular position.
g) Copy one matrix into another.
Think about your Copy command. Should this be a shallow or a deep copy?
Part 5: Testing
Create a test plan and use the driver you created in Part 4 to test your ADT. Make sure you reference the sections in your textbook about test plans and use the examples to help you.
Execute your test plan and write up your results. Does everything work? If not, fix and retest. Submit your final test results, which includes any issues you are having with your program, and explain what tests you ran (describe your test plan).
General iLab Comments
All coding assignments for this class will use Microsoft Visual Studio. This is available through the Software Store, which can be found in Course Home. Contact the Help Desk or your professor if you encounter any issues.
*Please note as a reminder that you may not copy code from any web reference to complete this assignment, even if you correctly give credit. You may, of course, use web references to help you understand, but you must code the assignment yourself. You may use code directly from your textbook where applicable, but do make sure you give credit in your comments if you are doing so.
* If you have any issues with the payment method, please let us know at firstname.lastname@example.org and that can be discussed and considered.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at email@example.com.
* As soon as the payment is received through PayPal, download link of the solution will automatically be sent to the address used in Paypal.
* Please check your junk mails as the download link email might go there.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at firstname.lastname@example.org and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at email@example.com.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.