CIS 163 |
Arrays |
Spring 2021 |
Objectives:
- Practice using parallel arrays
- Practice using "precomputed data"
- Practice using two dimensional arrays
Activity
You may complete this lab in pairs.
Begin by following this GitHub Classroom link and cloning the resulting repository: https://classroom.github.com/g/DSpfr0JM
(If you use IntelliJ and get an error like "release version 5 not supported", this StackOverflow post shows how to fix it.)
- Complete
Taxes.jointTaxes
. Hint: Use this rate schedule to prepare a "base" tax amount for each bracket. Tests are provided inTaxesTest.java
. Notice that the tests pass if your answer is within $1 of mine. This is because the values provided in many tax tables are rounded to the nearest dollar. - Complete
Neighbors.numEvenNeighborsOrthogonal
. For now, you may assume that the arrays is rectangular (i.e., that all rows have the same number of columns). The test inputs inNeighborsEasyTest
are all rectangular. - Complete
Neighbors.numEvenNeighborsAll
. For now, you may assume that the arrays is rectangular (i.e., that all rows have the same number of columns). The test inputs inNeighborsEasyTest
are all rectangular.
Extra Credit: Modify numEvenNeighborsOrthogonal
and numEvenNeighborsAll
so that they work
even if the input is "jagged" (i.e., that each row can have a different number of columns.) Use NeighborsJaggedTest
to test your updated code. (Hint: Do this on a separate branch in case you get stuck. That way you don't mess up your working
code that's due for "regular" credit.)
Submission
Commit the changes to the code. If you worked with a partner, be sure both names are in a comment at the head of each file. If your extra credit is somewhere other than themain
branch, be sure to clearly
indicate that.
Updated Wednesday, 12 May 2021, 8:23 AM