need help with some coding

Reply

Join Date: Nov 2009
Posts: 5
Reputation: bkafroboy69 is an unknown quantity at this point 
Solved Threads: 0
bkafroboy69 bkafroboy69 is offline Offline
Newbie Poster

need help with some coding

 
0
  #1
23 Days Ago
public boolean addEvent(int year, int month, int day, int hour, int minute, int duration, String what);
This will return true if the event was added and false otherwise. Only valid events will be added to the list.

i kind of understand what im suppose to do but i just cant figure out the coding. calenderEvent is being declared in another class. i just need help with these directions turning them into coding

  1. public boolean addEvent(int year, int month, int day,
  2. int hour, int minute, int duration, String what){
  3.  
  4. if(CalenderEvent != addEvent)
  5. return true;
  6. else if (CalenderEvent != addEvent)
  7. return false;
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,568
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso
 
0
  #2
23 Days Ago
You can't use == (or !=) to test for equality against Objects. You have to use the .equals() method. And your method is intended to return true if you successfully added the event to the calendar and false if adding the event to the calendar was not successful. Presumably, an event would be added successfully so long as the year, day, month, etc were all valid and provided the event itself was not already in the calendar. Otherwise, it would not be added successfully, and you would need to return false. Also - you made no attempt to actually add the event to the calendar, which is what you should be doing in that addEvent method. Before adding the event to the calendar, you need to check all those things I just mentioned. (Like checking that the year, day, month are valid).
Last edited by BestJewSinceJC; 23 Days Ago at 7:47 pm.
Out.
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 5
Reputation: bkafroboy69 is an unknown quantity at this point 
Solved Threads: 0
bkafroboy69 bkafroboy69 is offline Offline
Newbie Poster
 
0
  #3
23 Days Ago
mmkay that clears it up for me just a bit
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC