Results 1 to 3 of 3
Thread: Struggling need help
- 07-12-2012, 10:48 PM #1
Member
- Join Date
- Jul 2012
- Posts
- 1
- Rep Power
- 0
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.
- 07-12-2012, 10:58 PM #2
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 1
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:
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
- 07-16-2012, 05:00 AM #3
Re: Struggling need help
Please go through the Forum Rules -- especially the third paragraph.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Struggling to import JAR
By Mr ChriZ in forum AndroidReplies: 0Last Post: 01-12-2012, 10:53 AM -
Struggling with this code
By Shimless12 in forum New To JavaReplies: 5Last Post: 07-14-2011, 06:06 PM -
Struggling with enum!
By XmisterIS in forum New To JavaReplies: 4Last Post: 09-03-2010, 12:23 PM -
Struggling with AlphaComposite .. please help me
By jeshmal4u in forum Java 2DReplies: 3Last Post: 03-08-2010, 05:11 AM -
struggling with creating a GUI
By tuwannu in forum Advanced JavaReplies: 2Last Post: 12-01-2008, 02:53 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks