[Bluej-discuss] Blue j object wth java exercise 4.30
Colleen Penrowley
cpen at telus.net
Tue Apr 18 01:38:30 BST 2006
Hi Marko,
I suggest you take a close look at your logic. If the month is not valid
the method should display an error message and stop. What does yours do? If
you aren't sure, put a breakpoint on the first statement and use the
debugger to trace through the method as it runs.
Colleen
At 01:20 PM 4/16/2006 +1000, Marko Bajic wrote:
>Hi my name is Marko.
>i have finished exercise 4.30 of Blue J Objects with java but I am wondering
>if there is a better solution to the problem. This is what I have:
>
>public int joinedInMonth(int month)
> {
> int count = 0;
> if(month < 1 || month > 12){
> System.out.println("Not a valid month");
> Iterator it = members.iterator();
> while(it.hasNext()); {
> Membership variable = (Membership) it.next();
> if (variable.getMonth() == month){
> count++;
> }
>
> }}return count;}
>
>thankyou
>Marko
>
>_________________________________________________________________
>realestate.com.au: the biggest address in property
>http://ninemsn.realestate.com.au
>
>_______________________________________________
>mailing list bluej-discuss at bluej.org
>To unsubscribe or change your preferences, go to
>http://lists.bluej.org/mailman/listinfo/bluej-discuss
More information about the bluej-discuss
mailing list