[Bluej-discuss] Excercise 4.24

Marko Bajic mbnov26 at hotmail.com
Wed Apr 5 12:13:09 BST 2006


Thnakyou. This my first program. The close method works but I am having 
trouble getting the name of the bidder to work. This is what I have:

  public void close()
    {
        Iterator it = lots.iterator();
        while(it.hasNext()) {
            Lot lot = (Lot) it.next();
             Bid bid = (Bid)it.next();
            if(lot.getHighestBid() == null){
          System.out.println(lot.toString() + "unsold");
        }else{System.out.println(lot.toString()+ "sold" + bid.getBidder());


        }
    }
    }

Please help.

Thankyou

>From: Michael Kölling <M.Kolling at kent.ac.uk>
>Reply-To: General discussion for users of BlueJ <bluej-discuss at bluej.org>
>To: General discussion for users of BlueJ <bluej-discuss at bluej.org>
>Subject: Re: [Bluej-discuss] Excercise 4.24
>Date: Tue, 4 Apr 2006 14:23:39 +0100
>
>As I mentioned before (below), there is a getHighestBid() method in
>the Lot class.
>
>You cannot just write 'highestBid' -- it is not clear where the value
>would come from. Instead, you need to call the method. To call the
>method, you have to look out for two things: it needs the receiving
>object (lot) at the beginning (with dot notation) and it needs the
>parentheses at the end.
>
>Also, you have to take care to use the double-equal (==) for
>comparison, not =.
>
>Michael
>
>On 4 Apr 2006, at 11:22, Marko Bajic wrote:
>
> >
> >
> > Thankyou, but i am still having troubles. I write:
> >
> > public Lot close()
> >    {
> >        Iterator it = lots.iterator();
> >        while(it.hasNext()) {
> >            Lot lot = (Lot) it.next();
> >            if(highestBid = null){
> >          System.out.println(lot.toString() + "unsold");
> >        }else{System.out.println(lot.toString()+ "sold");
> >
> >        }
> >    }
> >
> > I just get a message that it is uunable to find highestBid. I know
> > I have to make it visible from here but I do not know how.
> >
> > Thankyou,
> > Marko
> >
> >

_________________________________________________________________
realestate.com.au: the biggest address in property  
http://ninemsn.realestate.com.au



More information about the bluej-discuss mailing list