| | |
need help with some coding
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Nov 2009
Posts: 5
Reputation:
Solved Threads: 0
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
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
Java Syntax (Toggle Plain Text)
public boolean addEvent(int year, int month, int day, int hour, int minute, int duration, String what){ if(CalenderEvent != addEvent) return true; else if (CalenderEvent != addEvent) return false;
•
•
Join Date: Sep 2008
Posts: 1,654
Reputation:
Solved Threads: 206
0
#2 Nov 5th, 2009
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; Nov 5th, 2009 at 7:47 pm.
Out.
![]() |
Similar Threads
- CODING QUESTION: What is the MOST importanting thing to do when...... (Computer Science)
- So drunk. Still coding. (Geeks' Lounge)
- Help Needed Urgently With Coding (Java)
- C++ Coding :: First Ever (C++)
- Is their a way to earn money from freelance VB coding on the net (Visual Basic 4 / 5 / 6)
Other Threads in the Java Forum
- Previous Thread: catch without try
- Next Thread: Crisis with co2 footprint program
Views: 156 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for Java
6 android api apple applet application arc arguments array arrays automation binary bluetooth bold c++ chat class classes client code compare component coordinates database datagram doctype draw eclipse educational error event exception file fractal froglogic game givemetehcodez graphics gui guitesting helpwithhomework html ide ideas image ingres input integer internet intersect ip j2me java javaexcel javaprojects jmf jni jpanel jtextarea julia linux list loop map method methods mobile netbeans newbie nextline number object oracle print problem program programming project recursion recursive scanner screen sell server set size sms socket sort sql string swing test threads time transfer tree user websites windows






