CSC 171
Homework 2

Assigned Feb 1, due Feb 11

This looks like a lot of methods to write, but each one is pretty short and simple. They'll probably each be ten to twenty lines long, and most of this is contracts, examples, and inventories.

Programming

For all the programming assignments, be sure to follow the design recipe. First, create a class; for now, all your methods will be in one class. Then, for each method,

  1. Write the method contract (either in plain English or in javadoc form) in Java comments.
  2. Write examples (either in comments ahead of the method, or in JUnit or Tester form once we get to this).
  3. Write the method skeleton.
  4. Add an inventory (in comments) between the curly-braces of the method skeleton.
  5. Fill in the method body after the commented inventory.
  6. Test your method: if you wrote your examples using JUnit, you can just hit the "Run Test Cases" button. If you wrote them using Tester, you can right-click on the test class and choose "testEverything()". If you wrote your examples in comments, copy and paste each example, one by one, into the CodePad, and see whether the answers match what you said they would be.

Be sure to choose meaningful names for methods and parameters, and watch for opportunities to re-use methods you, I, or the textbook have already written.

Also turn in a log of how many errors of different kinds you encountered in the assignment, with brief comments describing each one ("mismatched parentheses" is self-explanatory, but more complex errors might need more description). You may do this using the PSP forms, or simply by keeping track in a text file or on paper and turning it in.

Methods to write

For now, I recommend putting all of these in one class (say, Homework2).

Grading standards

Error log:       /45
(I'm not grading on how many or how few errors you encountered, only on whether you recorded them adequately.)

Programming:

Function name Contract Examples Skeleton and inventory Method definition
hoursToMinutes /5 /5 /5 /10
daysToHours /5 /5 /5 /10
daysToMinutes /5 /5 /5 /10
squarePerim /5 /5 /5 /10
circleArea /5 /5 /5 /10
avgThree /5 /5 /5 /10
dhmToMinutes /5 /5 /5 /10
celsiusToKelvin /5 /5 /5 /10
fahrenheitToCelsius /5 /5 /5 /10
fahrenheitToKelvin /5 /5 /5 /10
Modifications   /5 /5 /10
convert3digits /5 /5 /5 /10
convert3reversed /5 /5 /5 /10
quadraticFormula /5 /5 /5 /10

General skills:

Following directions /10
Writing contracts from word problems /10
Choosing examples /10
Names, white space, indentation, general readability /10
Coding /10
Code re-use and method composition /10

Total:         /450


Last modified:
Stephen Bloch / sbloch@adelphi.edu