|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlibrarytest.LibraryDate
public class LibraryDate
A date class to use for all library activities Has data elements: day (integer), month (integer), year (integer)
Constructor Summary | |
---|---|
LibraryDate()
Default constructor with no inputs that gets the real current date from the OS by using one of the built in date types (e.g., Date, Calendar, GregorianCalendar, …) The Java built-in type should ONLY be used to get the current date to put in the LibraryDate object. |
|
LibraryDate(int day,
int month,
int year)
Constructor that accepts an input day, month, and year, error checks these values and stores them in a new LibraryDate object. |
Method Summary | |
---|---|
LibraryDate |
addDays(int numdays)
Add a number of days to the current date |
int |
getDay()
|
int |
getMonth()
|
int |
getYear()
|
int |
howManyDays()
Compare two dates and return the number of days between the invoking date and the passed in date |
boolean |
setDay(int day)
Error check the value for day based on month and year |
boolean |
setMonth(int month)
Error check month value |
boolean |
setYear(int year)
Error check year for negative value |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LibraryDate()
public LibraryDate(int day, int month, int year)
day
- month
- year
- Method Detail |
---|
public LibraryDate addDays(int numdays)
numdays
-
public int getDay()
public boolean setDay(int day)
day
-
public int getMonth()
public boolean setMonth(int month)
month
-
public int getYear()
public boolean setYear(int year)
year
-
public int howManyDays()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |