[Bluej-discuss] Blue j object wth java exercise 4.31

Colleen Penrowley cpen at telus.net
Tue Apr 18 01:52:19 BST 2006


Marko,

Your code is difficult to read with all those curly braces stacked up at 
the end. I suggest you follow the style guide in the back of the book.

Again, think carefully about logic. What should happen if the month is not 
valid?

The method comment in the book says it will remove the members whose dates 
match the parameters, and return them in a separate collection object. The 
method signature indicates that it will return an ArrayList object. So you 
need to create an ArrayList object to put the purged members into for 
return, and add them to that collection when you find them. And you need to 
remove them from the members collection.  Take a look at the Iterator 
methods available to you.

Colleen


At 02:11 PM 4/16/2006 +1000, Marko Bajic wrote:
>hello, my name is marko. I am having trouble with exerciese 4.31 of Blue J
>objects with java. I cannot finish the purge method. this is what I have so
>far
>
>public ArrayList purge(int month, int year)
>     {if(month < 1 || month > 12){
>             System.out.println("Not a valid number");}
>         Iterator it = members.iterator();
>         while (it.hasNext()) {
>             Membership variable = (Membership) it.next();
>             if (variable.getMonth() == month && variable.getYear() == year){
>
>             }}}
>
>Please help,
>Marko
>
>_________________________________________________________________
>Test drive new cars from the comfort of your desk at carpoint.com.au
>http://secure-au.imrworldwide.com/cgi-bin/a/ci_450304/et_2/cg_801459/pi_1004813/ai_833884
>
>_______________________________________________
>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