⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lot.java

📁 现在在国外大学里最流行的java学习软件,同时还有大量的example,在名为project的文件里.安装好后用bluej打开peoject的例子,可以进行你想要的任何变化.同时可以了解大量的源码
💻 JAVA
字号:
/** * A class to model an item (or set of items) in an * auction: a lot. *  * @author David J. Barnes and Michael Kolling. * @version 2006.03.30 */public class Lot{    // A unique identifying number.    private final int number;    // A description of the lot.    private String description;    // The current highest bid for this lot.    private Bid highestBid;    /**     * Construct a Lot, setting its number and description.     * @param number The lot number.     * @param description A description of this lot.     */    public Lot(int number, String description)    {        this.number = number;        this.description = description;    }    /**     * Attempt to bid for this lot. A successful bid     * must have a value higher than any existing bid.     * @param bid A new bid.     * @return true if successful, false otherwise     */    public boolean bidFor(Bid bid)    {        if((highestBid == null) ||               (bid.getValue() > highestBid.getValue())) {            // This bid is the best so far.            highestBid = bid;            return true;        }        else {            return false;        }    }        /**     * @return A string representation of this lot's details.     */    public String toString()    {        String details = number + ": " + description;        if(highestBid != null) {            details += "    Bid: " +                        highestBid.getValue();        }        else {            details += "    (No bid)";        }        return details;    }    /**     * @return The lot's number.     */    public int getNumber()    {        return number;    }    /**     * @return The lot's description.     */    public String getDescription()    {        return description;    }    /**     * @return The highest bid for this lot.     *         This could be null if there is     *         no current bid.     */    public Bid getHighestBid()    {        return highestBid;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -