Results 1 to 3 of 3
  1. #1
    acbar is offline Member
    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Default Struggling need help

    I have to make a calendar using arrays in java. however I don't know where to begin.


    An event will be represented by a String.
    A calendar will be represented by an array of 32 Strings, with the String at index d of the array representing the event, if any, for the date d. E.g., index 5 holds the event for the fifth of the month. Index 0 of the array will not be used. If there is no event recorded for a date, the corresponding element of the array will be null.
    The method addEvent takes 3 arguments: a calendar (i.e., an array of strings), an event (i.e., a String), and a date (i.e., an int). If there is already an event scheduled for the date, addEvent does not change the array, and returns false. If there is no event scheduled for the date yet, addEvent stores the event in index date of the calendar array and returns true. If the date is erroneous, i.e. less than 1 or more that 31, addEvent just returns false.

  2. #2
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: Struggling need help

    I'm not sure if you are trying to create a functional calendar, or if you are just messing around with Java in order to learn (which is great, too!).

    However, this doesn't sound like a good idea if you are trying to create a functional calendar:

    Quote Originally Posted by acbar View Post
    An event will be represented by a String. If there is already an event scheduled for the date, addEvent does not change the array, and returns false.
    I advise you to make an array of ArrayLists so that you can add as many "events" as possible. The ArrayLists could be of type String as you suggested, but you also should consider making an Event class that stores its name, time, priority, ect.
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: Struggling need help

    Please go through the Forum Rules -- especially the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Struggling to import JAR
    By Mr ChriZ in forum Android
    Replies: 0
    Last Post: 01-12-2012, 10:53 AM
  2. Struggling with this code
    By Shimless12 in forum New To Java
    Replies: 5
    Last Post: 07-14-2011, 06:06 PM
  3. Struggling with enum!
    By XmisterIS in forum New To Java
    Replies: 4
    Last Post: 09-03-2010, 12:23 PM
  4. Struggling with AlphaComposite .. please help me
    By jeshmal4u in forum Java 2D
    Replies: 3
    Last Post: 03-08-2010, 05:11 AM
  5. struggling with creating a GUI
    By tuwannu in forum Advanced Java
    Replies: 2
    Last Post: 12-01-2008, 02:53 PM

Posting Permissions

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