Question: 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.

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 GregorianCalendar cal = new Gregorian Calendar(); // Today's date eckertsBirthday =

new GregorianCalendar (1919, 9); Calendar.APRIL, Use the values Calendar. JANUARY. . .

Your task is to write a program that prints:
• The date and weekday that is 100 days from today.
• The weekday of your birthday.
• The date that is 10,000 days from your birthday.
Use the birthday of a computer scientist if you don’t want to reveal your own.
The GregorianCalendar class is complex, and it is a really good idea to write a few test programs to explore the API before tackling the whole problem. Start with a program that constructs today’s date, adds ten days, and prints out the day of the month and the weekday.

GregorianCalendar GregorianCalendar cal = new Gregorian Calendar(); // Today's date eckertsBirthday = new GregorianCalendar (1919, 9); Calendar.APRIL, Use the values 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. The get method can be used to query a given GregorianCalendar object: int dayOfMonth = cal.get (Calendar.DAY_OF_MONTH); int month= cal.get(Calendar.MONTH);

Step by Step Solution

3.50 Rating (150 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Based on the task provided lets step through the process of writing a Java program that does the following 1 Constructs todays date using the Gregoria... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!