Class SpeedDating

java.lang.Object
  extended by SpeedDating

public class SpeedDating
extends java.lang.Object

A class to give students experience using loops. This class creates and manipulates objects of Greg's Date class.


Constructor Summary
SpeedDating()
          Create an empty SpeedDating object (this is known as a "default" constructor)
 
Method Summary
 void beMyValentine(int startYear)
          Prints the day of the week (e.g.
 Date discoverColumbusDay(int year)
          Computes and returns the Date on which Columbus Day will fall in a given year.
 Date getHalfWayDate(Date start, Date end)
          Returns the date that lies midway between two dates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpeedDating

public SpeedDating()
Create an empty SpeedDating object (this is known as a "default" constructor)

Method Detail

beMyValentine

public void beMyValentine(int startYear)
Prints the day of the week (e.g. "Thursday") on which Valentine's day will fall for 10 consecutive years Note: Valentine's Day is February 14th

Parameters:
startYear - the first of the 10 consecutive years

discoverColumbusDay

public Date discoverColumbusDay(int year)
Computes and returns the Date on which Columbus Day will fall in a given year. NOTE: By law, Columbus Day is the second Monday in October

Parameters:
year - the year for which to compute the date of Columbus Day
Returns:
the date of Columbus Day for the specified year

getHalfWayDate

public Date getHalfWayDate(Date start,
                           Date end)
Returns the date that lies midway between two dates. Precondition: The start date must occur on or before the end date.

Parameters:
start - the earlier of the two dates
end - the later of the two dates
Returns:
the Date halfway between the start date and the end date