[Instructions] [Search] [Current] [Syllabus] [Links] [Handouts] [Outlines] [Labs] [More Labs] [Assignments] [Quizzes] [Examples] [Book] [Tutorial] [API]
Back to Loops. On to When Things Go Wrong.
Held Friday, February 5
Summary
Contents
Notes
isWinter method that determines
whether the current date is between Dec. 21 and March 20 (inclusive),
without using if or other control structures.''
(Comments are not necessary.)
/**
* Determine whether the current date is between Dec. 21 and
* March 20 (inclusive).
*/
public boolean isWinter() {
return ( ((this.month == 12) && (this.day >= 21)) ||
(this.month == 1) || (this.month == 2) ||
((this.month == 3) && (this.day <= 20)) );
} // isWinter()
Do G1.1., G1.2 (only step 1), G1.3, and (if time permits) G1.5.
History
Back to Loops. On to When Things Go Wrong.
[Instructions] [Search] [Current] [Syllabus] [Links] [Handouts] [Outlines] [Labs] [More Labs] [Assignments] [Quizzes] [Examples] [Book] [Tutorial] [API]
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS152/99S/Outlines/outline.08.html
Source text last modified Fri Feb 5 10:54:11 1999.
This page generated on Fri Mar 12 13:12:34 1999 by SiteWeaver. Validate this page's HTML.
Contact our webmaster at rebelsky@math.grin.edu