CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2011
    Posts
    2

    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.

  2. #2
    Join Date
    Apr 2007
    Posts
    442

    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

  3. #3
    Join Date
    Jul 2011
    Posts
    2

    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.

  4. #4
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Creating and implementing class for creating a calendar object

    Last edited by Norm; July 29th, 2011 at 07:23 AM.
    Norm

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured