Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write code in java. A Calendar Class In this project, you will develop and test a CalendarDate class. Use the GregorianCalendar subclass of the

Please write code in java.

A Calendar Class

In this project, you will develop and test a CalendarDate class. Use the GregorianCalendar subclass of the Calendar abstract class. Here are the responsibilities of the class, that is, the services that the class will provide to users:

1. to initialize a CalendarDate object to represent the date entered by the user in the format (MM DD YYYY); an example would be January 1, 2012 (01 01 2012)

2. to initialize a CalendarDate object from integers for the month, day-of-month and year; if the date is invalid (for example, if the month, day-of-month and year are 6, 31 and 2006, respectively), use 01, 01, 2012;

3. return, in String form, the next date after this CalendarDate object; for example, if this CalendarDate object represents January 31, 2012, the return value would be February 1, 2012;

4. return, in String form, the date prior to this CalendarDate object; for example, if this CalendarDate object represents January 1, 2013, the return value would be December 31, 2012; 5. return, in String form, the day of the week on which this CalendarDate object falls; for example, if this CalendarDate object represents the date December 20, 2012, the return value would be Thursday;

Part a: Create method specifications for the above responsibilities.

Part b: Develop the CalendarDate class, that is, determine what fields to declare and then define the methods.

Part c: Create a project to test your CalendarDate class. Call each CalendarDate method at least twice. The project needs to accept input from the user, not just set a specific date and print. Also, repeatedly ask the user to enter an input and then designate a key or number for the user to input in order to end the program.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

e. Compute R2 and .

Answered: 1 week ago

Question

What is the preferred personality?

Answered: 1 week ago