|
home—info—lects—labs—exams—hws
tutor/PIs—java.lang docs—java.util docs
Complete the previous lab, and submit your file (both you and your partner each) on WebCT > assignments > lab03b.
If you finish that early and want to working on something more,
there is a small amount (4pts max, graded strictly) of extra credit
for completing the following and submitting your improved code to
to WebCT > assignments > lab03b-ec.
(Be sure you also submit your unimproved code above,
before starting on this!)
Make a copy of your entire function
Be sure to factor out any repeated code;
your upgrade should add about five (fairly simple) lines of code,
but should not double the number of lines of code.
hint: Don't think of it as “either multiply all my turns by -1, or do nothing”; instead think of it as “either multiply all my turns by -1, or multiply them by +1.”. This way, the only difference is the particularly number to multiply by. THis is reminiscent of the trick we used for getting theplural case right intoppingMsg from yesterday's lecture.
Re-write
Write
Finally, write
1
Actually, in Java you can name both functions
home—info—lects—labs—exams—hws
tutor/PIs—java.lang docs—java.util docs
©2010, Ian Barland, Radford University Last modified 2010.Sep.16 (Thu) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |