coffeebrewer.java

来自「ssd2 exercise3 的题目和答案」· Java 代码 · 共 82 行

JAVA
82
字号
/**
 * This class maintains the attributes and methods of the CoffeeBrewer.
 *
 * @author Luorenhu
 * @version  1.0.0
 */
public class CoffeeBrewer extends Product
{
	
	/* model */
    private String model;
    
    /* water supply */
    private String waterSupply;
    
    /* number of cups */
    private int numberOfCups;
    
    
    /**
	 * Constructs an <code>Coffee</code> object.
	 *
	 * @param initialCode  a string with the code of the coffee brewer.
	 * @param initialDescription  a string that describes the coffee brewer.
	 * @param initialPrice  a double that represents the price of the coffee brewer.
	 * @param initialModel  a string with the model of the coffee brewer.
	 * @param initialWaterSupply  a string with the water supply of the coffee brewer.
	 * @param initialNumberOfCups  a integer with the numbers of the cups of the coffee brewer.
	 */
    public CoffeeBrewer(String initialCode, String initialDescription, double initialPrice, 
    String initialModel, String initialWaterSupply, int initialNumberOfCups)
    {
        super(initialCode, initialDescription, initialPrice);
        model = initialModel;
        waterSupply = initialWaterSupply;
        numberOfCups = initialNumberOfCups;
    }
	
	 /**
	 * Returns the model of the coffee brewer.
	 *
	 * @return  model of the coffee brewer.
	 */
    public String getModel()
    {
        return model;
    }
	
	/**
	 * Returns the water supply of the coffee brewer.
	 *
	 * @return  water supply of the coffee brewer.
	 */
    public String getWaterSupply()
    {
        return waterSupply;
    }
	
	/**
	 * Returns the number of cups of the coffee brewer.
	 *
	 * @return  number of cups of the coffee brewer.
	 */
    public int getNumberOfCups()
    {
        return numberOfCups;
    }
	
	/**
	 * Returns the string representation of this <code>CoffeeBrewer</code>
	 * object (overrides the {@link Object#toString()} method).
	 *
	 * @return  the string representation of this <code>CoffeeBrewer</code>
	 *          object.
	 */
    public String toString()
    {
        String message = super.toString() + "_"+getModel() + "_"+getWaterSupply() + "_" + getNumberOfCups();
        return message;
    }
}

⌨️ 快捷键说明

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