Computer Science 210
Data Structures
Fall 2018, Siena College
You may work alone or with a partner on this assignment. However, in order to make sure you learn the material and are well-prepared for the exams, you should work through non-coding problems on your own before discussing them with your partner, should you choose to work with someone. Also, be sure every programming task is a team effort. In particular, the "you do these and I'll do these" approach is sure to leave you unprepared for the exams.
All GitHub repositories must be created with all group members having write access and all group member names specified in the README.md file by 4:00 PM, Monday, September 24, 2018. This applies to those who choose to work alone as well!
There is a significant amount of work to be done here, and you are sure to have questions. It will be difficult if not impossible to complete the assignment if you wait until the last minute. A slow and steady approach will be much more effective.
Getting Set Up
You will receive an email with the link to follow to set up your GitHub repository for this problem set (ps2-yourgitname). One member of the group should follow the link to set up the repository on GitHub, then that person should email the instructor with the other group members' GitHub usernames so they can be granted access. This will allow all members of the group to clone the repository and commit and push changes to the origin on GitHub.
More Matrix2D Enhancements
The functionality you are to add:
You can expect to have to write a method similar to one of these or the max method you wrote in lab for an upcoming quiz or exam.
Methods with ArrayLists
The above are good examples of the kind of methods you might see to write (on paper) for the first exam.
Working with Matrix2D and ArrayLists
Your program should behave as follows:
A sample run of the program follows:
What size should the matrices be? 4 Enter upper and lower bounds for values of the next matrix: 0 10 More matrices? (yes or no) yes Enter upper and lower bounds for values of the next matrix: -5 5 More matrices? (yes or no) yes Enter upper and lower bounds for values of the next matrix: 100 1000 More matrices? (yes or no) no You created 3 matrices. Matrix 0: 3.1446718232384363 8.903162109361647 6.572639506694643 9.411167855838547 3.9576692338913553 3.036466469570256 2.882164051987268 7.878830142793147 0.37334414421281603 1.848322408778147 9.00459393873155 3.049493102231743 1.5407520792899199 9.46042381998735 3.540809447693386 9.788365191490355 Matrix 1: -4.559865880159107 0.6291806500763286 1.0509700801099298 0.8178647751293671 3.9108069694191645 -3.3177025187941567 1.8256956973298912 3.1095583829430744 3.8029647799578044 -0.7924572257049824 2.394953330369538 -1.5242502832680929 1.5657404338568481 -1.3043698146796956 -4.379616646485256 -0.6519814183197914 Matrix 2: 656.8003249089386 734.8743060987506 929.6682570160574 586.4958117693284 141.76300614174164 634.278617280476 280.3411001673913 696.8632576871072 468.28855483559204 531.6301318604899 881.6724838298471 740.6011613187118 138.39443915176548 909.9372820343589 641.7058647921483 852.9217247520166 Sum of your matrices: 655.3851308520179 744.4066488581885 937.291866602862 596.7248444002963 149.63148234505215 633.9973812312521 285.04895991670844 707.8516462128434 472.46486375976264 532.685997043563 893.0720310989482 742.1264041376754 141.50093166491226 918.0933360396665 640.8670575933564 862.0581085251872 Product of your matrices: 32341.55753282696 25363.66446740007 47181.03848455002 11570.231300415671 445.4436419039385 -6843.498976159701 -3488.095298326223 -14565.559997021226 31117.243150853817 19522.023465712155 41003.513058813616 14901.525177420528 27434.24649173172 22970.548236054085 40201.078541088675 7056.7357512357885 Reverse product of your matrices: 1875.170476793529 40667.697168365936 37151.878749240015 28157.029744590596 1557.8464545383433 35412.862903365276 11770.702704385545 21311.188337583473 2057.015525273084 32751.784682379333 23977.3616193639 20306.318428118004 5084.92322843422 58456.994888280315 32394.971073511217 39806.82682147663
A Memory Diagram with ArrayLists
For a little more practice making memory diagrams, we will use the CourseGrades example.
Before making a diagram, it is important to make sure you understand which parts of the program are responsible for which computation and for storing the data. There are three major sections of the program:
Suppose the following commands are entered:
add 83.5 linus add 95 snoopy add 91 linus
and the program is currently executing the line
cg.add(name, grade);
in main, the (second) line
sg.addGrade(grade);
in the add method of CourseGrades, and has just finished the line
grades.add(grade);
in the addGrade method of StudentGrades for the addition of the second "linus" grade.
Note: for the purposes of this diagram, we will represent an ArrayList with its internal array and its size inside a box. So an ArrayList<Integer> named a declared in main with 3 values, 8, 2, and 4, would look like this:
Submitting
Your diagram may be submitted in hard copy or you may include it in electronic form in your repository.
Your submission requires that all required code deliverables are committed and pushed to the master for your repository's origin on GitHub. That's it! If you see everything you intend to submit when you visit your repository's page on GitHub, you're set.
Grading
This assignment is worth 80 points, which are distributed as follows:
> Feature | Value | Score |
Matrix2D scale method | 5 | |
Matrix2D multiply method | 10 | |
Matrix2D tests in main | 5 | |
ArrayList largest value method | 5 | |
ArrayList largest value tests | 2 | |
ArrayList multiples only method | 6 | |
ArrayList multiples only tests | 2 | |
Matrix2DList create and populate the list | 5 | |
Matrix2DList report count and print matrices | 2 | |
Matrix2DList compute and print sum and products | 10 | |
Question 1 memory diagram | 25 | |
Git commit frequency and message quality | 3 | |
Total | 80 | |