[Bluej-discuss] printing value of index local variable
Colleen Penrowley
cpen at telus.net
Wed Oct 4 17:13:01 BST 2006
Sheryl,
In exercise 4.15 you need to concatenate the value in the index with the
note retrieved for that index value. Along the lines of
System.out.println(index + notes.get(index)); To make it look like the
example in the book you will want to add in a string containing a colon and
a space.
The Membership class represents one member in a club. For each person in
your club you will have a new Membership object. The Membership object
stores the information about the month and year of joining. The array list
stores multiple Membership objects.
To find out how many members joined in a particular month you probably want
to look at each Member object, access its month, compare the month with the
one you're looking for, and add to a counter if it's a match. You need
some sort of loop to process the entire array list.
Hope this helps.
Colleen
At 07:00 PM 10/4/2006 +1300, Sheryl wrote:
>Hi
>
>1. I have the 2nd edition and I'm referring to ex 4.15 which asks for the
>listNotes method of the Notebook class to be modified. I have tried all
>sorts of variations and haven't been able to get it to work. How do I do this?
>
>2. Also I was wondering if you could clarify ArrayLists for me. I created
>a membership field of type ArrayList, constructor to initialise it and a
>method to add a new membership. Does it mean that if I want to store the
>number of times a membership occurs in a given month that I need another
>type of list/s? I get confused with the relationship between classes and
>names. What is the relationship between the membership field in the Club
>Class and the Membership Class?
>
> Have been trying to do ex 4.30 on defining a method to determine the
> number of members who joined in a given month. How do I do this?
>
>thanks
>
>Sheryl
>
>
>
><mailto:bubblez123 at xtra.co.nz>bubblez123 at xtra.co.nz
>_______________________________________________
>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