Skip to main content

CIS 163

Arrays

Summer 2020

Objectives:

Activity

You may complete this lab in pairs.

Begin by following this GitHub Classroom link and cloning the resulting repository: classroom.github.com/g/kV1fFtRt

(If you use IntelliJ and get an error like "release version 5 not supported", this StackOverflow post shows how to fix it.)

  1. Complete Taxes.jointTaxes. Hint: Use this rate schedule to prepare a "base" tax amount for each bracket. Tests are provided in TaxesTest.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.
  2. 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 in NeighborsEasyTest are all rectangular.
  3. 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 in NeighborsEasyTest 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 the main branch, be sure to clearly indicate that.

Updated Tuesday, 19 May 2020, 11:46 AM

W3c Validation