| | |
need help with some coding
![]() |
•
•
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,568
Reputation:
Solved Threads: 196
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.
![]() |
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
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer html ide image inetaddress integer integration intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods migrate mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree unlimited utility webservices windows






