![]() |
![]() |
|
home—info—lects—labs—exams—hws
tutor/PIs—breeze (snow day)
Object120 + its docs—java.lang docs—java.util docs
Due by Sep.25 (Tue) 23:59;
bring hardcopy to the following class.
Note that clarifications have been added in orange.
They do not make substantive changes to the assignment; they only clarify
questions (and might incorporate some of the advice taken from the discussion boards).
We are tired of so much copying/pasting, when we develop test cases!
Write the function
Note that we won't write test-cases for this function itself
(test cases for
hint: To tell if two numbers are close to each other, take their difference (which could be positive or negative), and see if theMath.abs olute value of that difference is less than your threshold.
Write the function
Before writing the body of the function, be sure to just write the signature and a stub function, and compile that to catch any existing syntax errors early.
Turn in a hard copy, and attach your
Note that there are quite a few ways to solve these problems
(particularly the last one).
For full credit, strive to re-use existing functions, when possible.
Do not use techniques not mentioned in class
(loops, arrays, lists, or re-assigning to a variable).
You may use any functions from class
If your code does not compile, or if it does not pass all your test cases, note that fact in a comment near the top of your file.
1If you like, you may also print something like a single dot. This is convenient to confirm that when you run tests, the computer is indeed checking things even if there seems to be no other indication nor return value. ↩
home—info—lects—labs—exams—hws
tutor/PIs—breeze (snow day)
Object120 + its docs—java.lang docs—java.util docs
©2012, Ian Barland, Radford University Last modified 2012.Oct.06 (Sat) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |