Java Reference
In-Depth Information
ellipse should touch the window boundaries, even if the window is
resized.
΢΢G Exercise P2.15. Write a program to plot the following face.
Provide a class FaceViewer and a class FaceComponent .
Additional programming exercises are available in WileyPLUS.
PROGRAMMING PROJECTS
΢΢΢ Project 2.1. The GregorianCalendar class describes a point in time,
as measured by the Gregorian calendar, the standard calendar that is
commonly used throughout the world today. You construct a
GregorianCalendar object from a year, month, and day of the
month, like this:
GregorianCalendar cal = new GregorianCalendar();
// Today's date
GregorianCalendar eckertsBirthday = new
GregorianCalendar(1919,
Calendar.APRIL, 9);
Use constants Calendar.JANUARY . . . Calendar.DECEMBER
to specify the month.
The add method can be used to add a number of days to a
GregorianCalendar object:
cal.add(Calendar.DAY_OF_MONTH, 10); // Now cal is ten
days from today
This is a mutator methodȌit changes the cal object.
77
78
The get method can be used to query a given GregorianCalendar
object:
Search WWH ::




Custom Search