[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[EIJ]
[CS152 2000F]
[CS153 2004S]
Back to Laboratory: Java Basics, Revisited. On to Standard Object Methods.
Held: Tuesday, 21 September 2004
Summary: Today we continue check our understanding of Java basics by writing some more simple Java programs.
Related Pages:
Assignments
Notes:
All of today's work should be in package userid.lab02
.
Please create and share the appropriate directories.
Write a Java interface called Date
that describes
the following methods:
String toString()
int getYear()
int getMonth()
String getMonthAsString()
int getDayOfMonth()
int getDayOfYear()
Date tomorrow()
Date yesterday()
a. Write a Java model class called DateV1
that implements the Date
interface. This class should have three fields: year, month, and dayofmonth. You do not need to worry about leap years.
b. Write a Java main class called TestDateV1
that creates a DateV1
with today's date and pritns the result of each of the methods in the class.
a. Write a Java mold class called DateV2
that implements the Date
interface. This class should have only two fields: year and dayofyear.
b. Write a Java main class called TestDateV2
that creates a DateV2
with today's date and pritns the result of each of the methods in the class.
Back to Laboratory: Java Basics, Revisited. On to Standard Object Methods.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Links]
[Syllabus]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[SamR]
[Java 1.4.2 API]
[EIJ]
[CS152 2000F]
[CS153 2004S]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Wed Dec 8 10:37:12 2004.
The source to the document was last modified on Thu Aug 26 20:22:22 2004.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS152/2004F/Outlines/outline.15.html
.
You may wish to
validate this document's HTML
;
;
Check with Bobby