BlueJ Chpt 4 - Auction Project - How to make removeLot method work after entering a new lot

Posted by Ellaine Ryan on Stack Overflow See other posts from Stack Overflow or by Ellaine Ryan
Published on 2010-03-14T13:19:25Z Indexed on 2010/03/14 13:25 UTC
Read the original article Hit count: 301

Filed under:
|

Hi All

I am learning Java through BlueJ

I would like to add a removeLot method to the Auction Class in BlueJ Chpt 4. This involves also returning the lot with the given number or null if there is no such lot.

If you enter , say 5 lots and then use the remove method, this codes removes whichever lot you specify. However if you enter a new lot after using the removeLot method - an internal error message comes up regarding lotnumbering .

Any ideas?

Thanks Elaine

public Lot removeLot(int number) {

    if((number >= 1) ) {           

    }
    Lot lot = getLot (number);
    if(lot !=null) {
        lots.remove(lot);
    }
    return lot;
}

© Stack Overflow or respective owner

Related posts about java

Related posts about beginner