Creating and implementing class for creating a calendar object
Hi, so I have to create and implement a class for creating calendar objects. Some of the behaviours that the class has to do is:
- Print a display for a given month and year
- Print a display for the current month
- Get the current date
- Set the current date
- Roll the calendar date forward or backward by a given number of days or months
- A toString() method.
I also have to provide a selection of constructors with default values for the variables.
Now.. I have absolutely, no f*****g clue of what to do. I don't even know where to start. Please, please, please, could somebody give me a nudge in the right direction of where to start?
Thanks in advance.
Re: Creating and implementing class for creating a calendar object
I dont know if this is a school exercise. If it is, you need to follow the requirements (whatever they are) specifically. Any case, I would give you these pointers:
What you seem to be doing, could IMHO be best implemented with a library class. Especially if you have no direct requirement to ever actually return a Calendar object. Calendars are heavy, so make a class with library methods, that make use of an internal pool of Calendars where needed. For instance, in pseudo:
long shiftByDays(long time, int days)
reserve a calendar from pool
set calendar to given time
adjust calendar field(s)
collect calendar time
return the calendar to pool
return collected time
Re: Creating and implementing class for creating a calendar object
Thanks for the reply!
It is a school project, so I do have to follow the requirements strictly. The problem is, I understand what we're being asked to do, I just don't know how to do it. Especially with the constructors. I don't understand what I need to write so that a calendar object can be created using the class. As much as I don't want to ask, if somebody could perhaps write a bit of the constructor in Java or just pseudo, maybe I could get the jist of what I need to do from that and carry on.
Re: Creating and implementing class for creating a calendar object