Class DateConversion
java.lang.Object
|
+--DateConversion
- public class DateConversion
- extends Object
Write a description of class DateConversion here.
- Version:
- Feb. 5, version 1
- Author:
- Stephen Bloch
Method Summary |
(package private) static String |
dayFinder(int month,
int day)
dayFinder: finds the day of the week for any given date in 2001. |
(package private) static int |
daysAway(int month,
int day)
daysAway: find how many days a specified date is from the beginning of the year. |
static void |
test()
Where we put all the standard test cases |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
DateConversion
public DateConversion()
dayFinder
static String dayFinder(int month,
int day)
- dayFinder: finds the day of the week for any given date in 2001.
- Parameters:
month
- an int, the month number (Jan=1, Feb=2, etc.)day
- an int.- Returns:
- a String, the day of the week.
Examples: dayFinder(1,1) should return "Monday"
dayFinder(1,20) should return "Saturday"
dayFinder(2,1) should return "Thursday"
dayFinder(7,13) should return "Friday"
daysAway
static int daysAway(int month,
int day)
- daysAway: find how many days a specified date is from the beginning of the year.
- Parameters:
month
- an int, the month number (Jan=1, Feb=2, etc.)day
- an int.- Returns:
- an int, the number of days (e.g. Jan. 1 gives 1).
Examples: daysAway(1,1) should return 1
daysAway(1,20) should return 20
daysAway(2,1) should return 32
daysAway(12,31) should return 365
Note: this version of daysAway uses recursion rather than a loop.
test
public static void test()
- Where we put all the standard test cases
Generated by BlueJ